1 2 3 4 | $ docker run -it xxx /bin/bash // 启动一个container $ docker rm -f xxx // 结束一个container,加-f表示删除掉,这样比较干净 $ docker run -it --add-host host:ip xxx /bin/bash // 启动一个container,增加/etc/hosts设定 $ docker run -d -p 127.0.0.1:5000:5000 webapp python app.py // 启动一个container,映射本地的5000端口 |
---|
1 2 3 4 5 | $ docker rmi -f xxx // 删除一个image,以下情况下不能删除: // * 有其他image依赖于这个image // * 有已创建的container依赖于这个image // build的过程会出现很多<none>的临时image,最好不要去手工清除 $ docker build tag Dockerfile_dir // build一个image |
---|
DOCKER_OPTS
--insecure-registry own-docker.com
-s overlay
使用overlay极大提升性能和稳定性,建议开启。但是有两个问题:
inotify_add_watch
调用,tail -f
类的命令会有问题,具体见:https://github.com/docker/docker/issues/11705https://github.com/jwilder/docker-squash
https://github.com/jpetazzo/nsenter
https://github.com/memoryboxes/dockerfly
https://github.com/shipyard/shipyard