Common operation instruction Docker

Brief introduction

Docker's three terms, warehouses, mirroring, container

Warehouse: docker for storing image can be understood as a physical storage

Mirror: docker image is a read-only template. (Your development environment can be integrated in the Mirror Image)

Container: Create a container with a mirror, the equivalent of a mirrored instance, the container is in memory, virtualized environment, when you exit, the vessel will be freed

docker Chinese community Manual: http://www.docker.org.cn/book/docker/docker-install-package-9.html

Mirroring

Pulling a remote mirroring

sudo docker pull 镜像名
sudo docker pull 镜像名 :指定版本

See all mirrors

sudo docker image ls
sudo docker images

Remove Mirror

sudo docker image rm 镜像名
sudo docker rmi 镜像id

Container operations

View container running

sudo docker container ls
sudo docker ps

View all containers

sudo docker container ls --all
sudo docker ps -a

Delete container

sudo docker rm 容器名

Use a mirror to create a container

Command: sudo docker run [parameters] Mirror [command of]

sudo docker run ubuntu:14.04 /bin/bash

Note: this can not be used to run the program immediately stop, otherwise the program ends, the container will be over soon.

Named to the container and run

sudo docker run -it --name=myubuntu ubuntu /bin/bash

Guardian container: and start running, you only use the stop command to exit when closed

sudo docker run -dit --name=rong1 ubuntu

Description: -i representation allows input, -t specified container, -it interact, -dit daemon

Start container

sudo docker start 容器名

Stop the container

sudo docker stop 容器名

Rename container

sudo docker rename oldname newname

Save or read the local

The containers hold the mirror:

sudo docker commit 容器名 镜像名

Save the image file locally:

sudo docker save -o 文件名.tar 镜像名

Load local image file:

sudo docker load -i 本地镜像名

Guess you like

Origin blog.csdn.net/dakengbi/article/details/93746309