# Command used outside container # image docker images docker search ubuntu docker pull ubuntu:15.10 docker pull training/webapp docker rmi hello-world docker tag 860c279d2fec runoob/centos:dev docker commit -m="has update" -a="runoob" e218edb10161 runoob/ubuntu:v2 # ? # container docker run -t -i ubuntu:15.10 /bin/bash # run create new container, ubuntu is a 'image name' docker run -itd --name ubuntu-test ubuntu:15.10 /bin/bash # '-d' means running in background docker run -d -P training/webapp python app.py # random port of host -> port of container docker run -d -p 5000:5000 training/webapp python app.py # 5000 -> 5000 docker start b750bbbcfd88 # b750bbbcfd88 is a 'container id' docker stop b750bbbcfd88 docker restart b750bbbcfd88 docker exec -it b750bbbcfd88 /bin/bash # enter container that running in background docker rm -f b750bbbcfd88 docker container prune # clean all that exited
docker ps -a docker port b750bbbcfd88 docker port ubuntu-test docker logs -f bf08b7f2cd89 # Running on http://0.0.0.0:5000/ (Press CTRL+C to quit) docker top ubuntu-test # PID, ... docker inspect ubuntu-test # detaied config and state