一 docker常用命令
1. service docker start
2. docker images 显示所有镜像
3. docker ps [-a] 显示正在运行的容器,-a显示所有容器
4. docker run -i -t repo:tag cmd 由镜像创建一个容器,-i表示交互,-t表示伪终端
5. docker run -d -v srcdir:dstdir repo:tag cmd 创建容器,并挂载宿主机目录到容器内目录,后台运行,-d后台运行,-v挂载
6. docker logs containerID 查看容器监控的进程运行日志
7. docker stop containerID
8. docker rm containerID
9. docker rmi imageID
10. docker search key
11. docker pull imagename
12. docker build -t repo:tag dir
13. docker tag imageID repo:tag 添加新tag
14. docker attach containerID 进入容器
15. docker cp file containerID:file 宿主机与容器进行传递文件或目录,顺序可互调
16. docker history imageID 查看层级信息
二、dockerfile
eg:
FROM nginx LABEL maintainer "angelkitty6698@gmail.com" COPY 1.txt /home RUN echo '<h1>Hello, Docker!</h1>' > /usr/share/nginx/html/index.html
可以参考:
http://www.runoob.com/docker/docker-image-usage.html
http://dockone.io/article/8350
https://www.toutiao.com/i6313838452630618626/
https://www.docker-cn.com/registry-mirror
https://www.cnblogs.com/cocowool/p/make_your_own_base_docker_image.html
https://docs.docker.com/engine/reference/commandline/cp/