docker 指令

最小化容器

ctrl + p + q

恢复容器

docker exec -it userdockername /bin/bash

运行容器

docker run -it --name userdockername -v /e/docker/docker_volume:/data node:latest /bin/bash

(windows 环境下需要在Resources -> File Sharing 中添加 e 盘目录)

删除镜像

docker rmi imageName:tag

从宿主机拷贝到容器中(宿主机的 file.js 拷贝到容器的 /home/xxx 目录下)

docker cp /xxx/xx/file.js containerName:/home/xxx

从容器中创建新、镜像

docker commit -a 'author' containerId new_images_name:tag

将镜像保存为文件

docker save -o filename.tar images_name:tag

从文件导入镜像

docker import filename.tar images_name:tag

 

docker run 

--detach , -d       Run container in background and print container ID
--interactive , -i     Keep STDIN open even if not attached
--tty , -t       Allocate a pseudo-TTY
--name       Assign a name to the container
--publish , -p      Publish a container’s port(s) to the host
--volume , -v      Bind mount a volume

 

posted @ 2020-08-05 15:45  W-it-H-ou-T  阅读(374)  评论(0编辑  收藏  举报