Skip to content

Instantly share code, notes, and snippets.

@notsobad
Last active August 29, 2015 14:10
Show Gist options
  • Save notsobad/7d38b11db0ebddcff9ce to your computer and use it in GitHub Desktop.
Save notsobad/7d38b11db0ebddcff9ce to your computer and use it in GitHub Desktop.
docker笔记

doker

install

apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9

sh -c "echo deb http://get.docker.com/ubuntu docker main > /etc/apt/sources.list.d/docker.list"

apt-get update
apt-get install lxc-docker



docker build -t notsobad/monitor-agent .

docker run --name monitor notsobad/monitor-agent 

docker stop 


docker run --name=monitor --net=host --rm -it notsobad/monitor-agent bash

tip

docker run ubuntu bash -c 'while true;do date;sleep 1;done'
docker run -d ubuntu bash -c 'while true;do date;sleep 1;done'

docker ps 
docker stop happy_morse


docker build -t notsobad/monitor .



# 
https://docs.docker.com/articles/dockerfile_best-practices/


https://docs.docker.com/examples/running_redis_service/

docker删除停用的container: docker rm  `docker ps --no-trunc -aq`, 删除未tag的images: docker images -q --filter "dangling=true" | xargs docker rmi


images与container的区别:
http://stackoverflow.com/questions/21498832/in-docker-whats-the-difference-between-a-container-and-an-image/21499102#21499102

expose与publish的区别:
http://stackoverflow.com/questions/22111060/difference-between-expose-and-publish-in-docker?rq=1

如何正确的在docker中运行项目,使用volumn:
http://stackoverflow.com/questions/24272535/rebuild-container-after-each-change?rq=1

# network debug
https://blog.andyet.com/2014/09/11/docker-host-iptables-forwarding
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment