Docker笔记

From: https://www.gitbook.com/book/yeasy/docker_practice/details

BASIC

Just some commands…

sudo chmod +s /usr/bin/docker (give docker an ‘s’)

docker pull ubuntu (like git..)

docker run -idt –hostname test –name test ubuntu (a background ubuntu bash, use docker-enter to enter it or nsenter its pid)

docker rm (rm containers)

docker rm $(docker ps -a -q)

docker rmi (rm images)

From: https://raw.githubusercontent.com/yeasy/docker_practice/master/_local/.bashrc_docker

docker-enter container

docker run -d -p 5000:5000 registry

docker run -idt –hostname test -v /opt/docker-share:/root/share ubuntu (When rm use docker rm -v xxx)

docker run -d -v /dbdata –name d-data ubunutu

docker run -dti -p 5000:5000 ubuntu

docker run -dti -p 127.0.0.1:5000:5000 ubuntu

docker run -dti -p 127.0.0.1:5000:5000 -p 2333:80 ubuntu

docker run -dti -p 127.0.0.1:5000:5000/udp ubuntu

docker run -dti -P ubuntu

docker port [tag_or_name_of_container]

ps: container’s name is exclusive.

docker run -dti –hostname test-db –name db ubuntu

docker run -dti –hostname test-web –name web –link db:db ubuntu # And you can ping db to get direct connection to db container

ADVANCED

comments powered by Disqus