WSL 安裝 Docker === WSL 下輸入 ``` # Step 1: Update Software Repositories sudo apt-get update # Step 2: Uninstall Old Versions of Docker sudo apt-get remove docker docker-engine docker.io # Step 3: Install Docker sudo apt install docker.io # Step 4: Start and Automate Docker sudo systemctl start docker sudo systemctl enable docker # Step 5 (Optional): Check Docker Version docker --version ``` 如果出現錯誤訊息 :::danger Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? ::: 記得輸入啟動 Docker 指令 ``` sudo service docker start ``` 如果是 WSL 是無法啟動 Docker :::info 參考網路技術分享文章: https://blog.csdn.net/u012814856/article/details/86130341 因為 WSL 不支援 Docker 進程 解決方法請參考網路技術分享文章: https://www.cnblogs.com/xiaoliangge/p/9134585.html ![](https://i.imgur.com/IMwl0AU.png) 開啟黃色 Expose daemon on tcp://localhost:2375 without TLS 再 WSL 上輸入指令 ``` export DOCKER_HOST=tcp://127.0.0.1:2375 vim ~/.bashrc # 在 ~/.bashrc 最後一行新增一行指令 export DOCKER_HOST=tcp://0.0.0.0:2375 source ~/.bashrc ``` 讓 WSL 連接到 Docker for Windows 就能正常的在 WSL 上使用 Docker ::: ###### tags: `WSL` `Docker` `工作紀錄`
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up