前言
到了2020年才知道docker也在windows 能執行了,之前一直都是在hyper-v的虛擬機上面跑
https://docs.docker.com/docker-for-windows/release-notes/ Docker Desktop for Windows Stable Release notes
安裝
https://docs.docker.com/docker-for-windows/install/ Install Docker Desktop on Windows
https://hub.docker.com/editions/community/docker-ce-desktop-windows/ Docker Desktop for Windows
安裝成功後開機會自動執行Docker Desktop
開始使用
安裝成功Docker Desktop後無containers和images的畫面
安裝第一個container
直接使用git bash可以呼叫到docker 和docker-compose命令,直接在git bash上執行
(使用90端口,避免和XAMPP的80端口衝突)
$ docker run -d -p 90:80 docker/getting-started
Unable to find image 'docker/getting-started:latest' locally
latest: Pulling from docker/getting-started
188c0c94c7c5: Pull complete
61c2c0635c35: Pull complete
378d0a9d4d5f: Pull complete
2fe865f77305: Pull complete
b92535839843: Pull complete
ebe280ac36f4: Pull complete
b7beeb601852: Pull complete
Digest: sha256:7434aacfacb3c2d7d49f013e8a8092fde022c8b9f058b7fae7077e9cad1edc99
Status: Downloaded newer image for docker/getting-started:latest
661e2d85e8b11aad23994a53d869fd476a18e5524ebc442c2884ba0825cb9f59
然後就可以在 Docker Desktop 看到新的containers和images
laradock
build容器時因為網路不好報錯:
Step 146/294 : RUN if [ ${INSTALL_NODE} = true ]; then mkdir -p $NVM_DIR && curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash && . $NVM_DIR/nvm.sh && nvm install ${NODE_VERSION} && nvm use ${NODE_VERSION} && nvm alias ${NODE_VERSION} && if [ ${NPM_REGISTRY} ]; then npm config set registry ${NPM_REGISTRY} ;fi && if [ ${INSTALL_NPM_GULP} = true ]; then npm install -g gulp ;fi && if [ ${INSTALL_NPM_BOWER} = true ]; then npm install -g bower ;fi && if [ ${INSTALL_NPM_VUE_CLI} = true ]; then npm install -g @vue/cli ;fi && if [ ${INSTALL_NPM_ANGULAR_CLI} = true ]; then npm install -g @angular/cli ;fi
&& ln -s `npm bin --global` /home/laradock/.node-bin ;fi
...
npm ERR! code ECONNRESET
npm ERR! network aborted
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
解法
Windows 打開proxy和shadowsocks,換一個IP重新build就可以了
XDebug
放棄,搞不定。還是用hyper-v中的laradock斷點(HTTP+CLI都可以)
沒有留言:
張貼留言