容器 - Part2:Containers
备注:
docker build -t friendlyhello . # Create image using this directory's Dockerfile 使用此目录的Dockerfile创建映像
docker run -p 4000:80 friendlyhello # Run "friendlyhello" mapping port 4000 to 80 运行“friendlyhello”映射端口4000到80
docker run -d -p 4000:80 friendlyhello # Same thing, but in detached mode 创建相同的东西,但是处于分离
docker container ls # List all running containers 列出所有正在运行的容器
docker container ls -a # List all containers, even those not running 列出所有的容器(包含未运行的)
docker container stop <hash> # Gracefully stop the specified container Stop指定的容器
docker container kill <hash> # Force shutdown of the specified container Kill指定的容器
docker container rm <hash> # Remove specified container from this machine 在机器上删除指定的容器
docker container rm $(docker container ls -a -q) # Remove all containers 在机器上删除所有的容器
docker image ls -a # List all images on this machine 列出本机的所有的image
docker image rm <image id> # Remove specified image from this machine 删除指定的image
docker image rm $(docker image ls -a -q) # Remove all images from this machine 删除所有的image
docker login # Log in this CLI session using your Docker credentials 使用docker凭据登陆
docker tag <image> username/repository:tag # Tag <image> for upload to registry 上传到信息库
docker push username/repository:tag # Upload tagged image to registry 下载信息库
docker run username/repository:tag # Run image from a registry 运行信息库

浙公网安备 33010602011771号