#ãã¼ã¸ã§ã³ç¢ºèª $ docker version $ docker-compose version $ docker-machine version #åæ¢ä¸ã®ã³ã³ããã使ã£ã¦ããªãã¤ã¡ã¼ã¸ããããã¯ã¼ã¯ãã¾ã¨ãã¦åé¤ $ docker system prune #ä»®æ³ãã·ã³ã®ç¢ºèª $ docker-machine ls #ä»®æ³ãã·ã³ãèµ·å $ docker-machine start #ä»®æ³ãã·ã³ãåæ¢ $ docker-machine stop #ã¤ã¡ã¼ã¸ã®ç¢ºèª $ docker images #ã¤ã¡ã¼ã¸ã®æ¤ç´¢ $ docker search centos #DockerHubããã¤ã¡ã¼ã¸ããã¦ã³ãã¼ã $ docker pull centos:7 #ã¤ã¡ã¼ã¸åé¤ $ docker rmi centos:7 #ä¸è¦ãªã¤ã¡ã¼ã¸ããã¹ã¦åé¤ $ docker image prune #使ç¨ãã¦ããªãã¤ã¡ã¼ã¸ããã¹ã¦åé¤ # docker image prune -a #ã³ã³ããã®ç¢ºèª $ docker ps #ã³ã³ããã®ç¢ºèª(ãã¹ã¦) $ docker ps -a #ã³ã³ããä½æ #-dï¼ããã¯ã°ã©ã¦ã³ãå®è¡ã-pï¼ããã¹ã:ã³ã³ãããã§ãã¼ã転éã--nameï¼ã³ã³ããåãè¨å® $ docker run -d -p 8080:80 --name nginx nginx #ã³ã³ããä½æ #-itï¼ãã¹ãã¨ã³ã³ããã®æ¨æºå ¥åºåãã¤ãªãã $ docker run -it -d -p 8080:80 --name centos centos:7 #ã³ã³ããèµ·å $ docker start nginx #ã³ã³ããåæ¢ $ docker stop nginx #ã³ã³ããåé¤ $ docker rm centos #ã³ã³ããã«æ¥ç¶(ãã°ã¤ã³) #æ°ãã«bashããã»ã¹ãä½æãã¦æ¥ç¶ãã $ docker exec -it centos bash #ã³ã³ããã®æ¥ç¶(ãã°ã¤ã³) #æ¨æºå ¥åºåã«æ¥ç¶ãã¦ãããããexitã§ãã°ã¢ã¦ãããã¨ã³ã³ããèªä½ãåæ¢ãã $ docker attach centos #ã³ã³ããããã¤ã¡ã¼ã¸ãæ°ãã«ä½æ $ docker commit centos original-nginx #ã³ã³ããèµ·åã¨åæã«ãã°ã¤ã³ãããã°ã¢ã¦ãã§ã³ã³ããåé¤ #Dockerfileä½ææãªã©ãã³ãã³ãå®è¡ã¨Dockerfileè¨è¼ãç¹°ãè¿ãéã«ä¾¿å© $ docker run -it -p 8080:80 --rm --name centos centos:7 bash #Dockerfileããã¤ã¡ã¼ã¸ä½æ(ãã«ã) #-tï¼ã¤ã¡ã¼ã¸åã.ï¼Dockerfileã®ãã¹ #ã¤ã¡ã¼ã¸åã®ã¿ã°ãçç¥ããã¨latestã¨ãªã $ docker build -t original-nginx . #Dockerfileããä½æããã¤ã¡ã¼ã¸ã§ã³ã³ããèµ·å $ docker run -it -d -p 8080:80 --name build-nginx original-nginx #ãããã¯ã¼ã¯ãç¢ºèª $ docker network ls #ãããã¯ã¼ã¯ãä½æ $ dockernetwork create test-network #Docker Composeãã«ã $ docker-compose build #Docker Composeãã«ã #--no-cacheï¼ãã£ãã·ã¥ã使ç¨ããªãããã«ã対象ãappãµã¼ãã¹ã®ã¿ã¨ãã $ docker-compose build app --no-cache #Docker Composeã³ã³ããä½æã»èµ·å #-dï¼ããã¯ã°ã©ã¦ã³ãå®è¡ $ docker-compose up -d #Docker Compose appãµã¼ãã¹ããã³ã³ããä½æã»èµ·å $ docker-compose up -d app #ã³ã³ããã®èµ·åãã°ãåºå $ docker-compose logs #Docker Compose appãµã¼ãã¹ããæ°ããªã³ã³ãããä½æãã¦ã³ãã³ãå®è¡ #ã³ãã³ããå®è¡ããåæ°ã ãã³ã³ãããå¢ãã¦ãã $ docker-compose run --rm app rails db:create #Docker Compose æ¢åã®appã³ã³ãããèµ·åãã¦ã³ãã³ãå®è¡ $ docker-compose exec app bash #Docker Compose ãµã¼ãã¹å ã®ã³ã³ãããèµ·å $ docker-compose start #Docker Compose ãµã¼ãã¹å ã®ã³ã³ãããåæ¢ $ docker-compose stop #Docker Compose ãµã¼ãã¹å ã®ã³ã³ãããåé¤ $ docker-compose rm #Docker Compose appãµã¼ãã¹ã®ã³ã³ããã®ã¿åé¤ $ docker-compose rm app #Docker Composeãµã¼ãã¹å ã®ã³ã³ãããåæ¢ãããããã¯ã¼ã¯ãã¨ã³ã³ãããåé¤ $ docker-compose down #Docker Composeãµã¼ãã¹å ã®ã³ã³ãããåæ¢ãããããã¯ã¼ã¯ãã¨ã³ã³ããã»ã¤ã¡ã¼ã¸ãåé¤ $ docker-compose down --rmi all