WSL環境でDockerを動かす

Standard

C:\Windows\system32>bash #一番大切!Windows10で管理者としてコマンドを開く
sudo apt show docker.io -a
sudo apt remove docker.io
sudo apt -y install docker.io=17.12.1-0ubuntu1
sudo cgroupfs-mount
sudo service docker start
sudo service docker status
 
sudo docker run hello-world
 Hello from Docker!
 This message shows that your installation appears to be working correctly.
 ...
 
sudo docker run -p 8080:80 -d nginx:latest
 Unable to find image 'nginx:latest' locally
 latest: Pulling from library/nginx
 6ae821421a7d: Pull complete
 58702d4af197: Pull complete
 b165f42e8fd4: Pull complete
 Digest: sha256:18c0755594af107923baa2e65fcef35aea4ab0cea7862d19c27aa127bacb458e
 Status: Downloaded newer image for nginx:latest
 9839a49dbe9787f0d9af106bed6b1bc01e8101e5cdb50ce285826cd32d21c66f
 
sudo docker ps
 CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                  NAMES
 9839a49dbe97        nginx:latest        "nginx -g 'daemon of…"   2 minutes ago       Up About a minute   0.0.0.0:8080->80/tcp   loving_carson
 
sudo docker ps -a -q
 9839a49dbe97
 
#削除は「まずコンテナ、次にイメージ」の順序
sudo docker container prune
sudo docker rm $(docker ps -a -q)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.