端口映射和GPU使用 docker run -ti -p 8000:80 --runtime=nvidia -e NVIDIA_DRIVER_CAPABILITIES=compute,utility -e NVIDIA_VISIBLE_DEVICES=all recognition/v2 "/bin/bash"
从Dockefile创建docker Image:
docker build -f docker-build/Dockerfile . -t projects/stylegan2:v1
使用GPU和端口映射:
docker run -ti -p 80:80 --runtime=nvidia -e NVIDIA_DRIVER_CAPABILITIES=compute,utility -e NVIDIA_VISIBLE_DEVICES=all projects/stylegan2:v1 "/bin/bash"
把docker run -ti改成docker run -tdi可使得container运行在后台
拷贝内容到容器,或者从容器到本地
docker cp testtomcat:/usr/local/tomcat/webapps/test/js/test.js /opt
docker cp /opt/test.js testtomcat:/usr/local/tomcat/webapps/test/js
创建守护态的docker container
sudo docker run -itd ubuntu:14.04 /bin/bash
进入container
sudo docker attach 44fc0f0582d9
container转image
docker commit [containerID] [imagename]:[version]
image转文件
docker save [image名] > [文件路径(需要是tar文件)]
container转文件
docker export [containerID] > [文件路径(需要是tar文件)]
加载保存的image
docker load < [tar文件路径]
加载保存的container
docker import [tar文件名] [imagename]:[version]
再次打开container
docker start goofy_almeida
退出container但是不结束
Ctrl+P+Q
退出container并且结束
Ctrl+d