Swoole 從入門到實戰 工作坊 | Docker 環境安裝筆記

Photo by Kelly Sikkema (https://unsplash.com/@kellysikkema) on Unsplash (https://unsplash.com/)
Photo by Kelly Sikkema on Unsplash

上課時使用的筆電是 Win10 家用版,因 Docker for Windows 只能在旗艦版中安裝,家用版無法直接使用 Docker,因此選擇在 Homestead 中安裝 Docker 使用。

安裝環境

先 clone swoole-course-examples 到本地:

Terminal window
git clone https://github.com/albertcht/swoole-course-examples.git

開啟 homestead.yaml 設定環境,資料夾掛載、開啟 Docker、掛載 9501 Port,設定完成後就可以 vagrant up:

homestead.yaml
folders:
- map: d:/dev/code/swoole-course-examples
to: /home/vagrant/code/swoole-course-examples
features:
- docker: true
ports:
- send: 9501
to: 9501

登入 Vagrant SSH,切換到 swoole-course-examples 資料夾,執行 Docker image:

Terminal window
docker run -it --name swoole -v $PWD:/src -p 9501:9501 albertcht/swoole

參考資料