|
The author here is CnetOS6.5 system
Start the installation daoker Tour:
[Root @ localhost ~] # uname -r
2.6.32-431.el6.x86_64
[Root @ localhost ~] # cat / etc / issue
CentOS release 6.5 (Final)
Kernel \ r on an \ m
Note that other sources may cause your kernel version inconsistent and docker, need to upgrade the kernel to 3.x.
installation:
[Root @ localhost ~] # rpm -ivh http://dl.Fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
Retrieving http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
warning: /var/tmp/rpm-tmp.JN76fI: Header V3 RSA / SHA256 Signature, key ID 0608b895: NOKEY
Preparing ... ########################################### [100% ]
1: epel-release ########################################### [100 %]
[Root @ localhost ~] # rpm --import / etc / pki / rpm-gpg / RPM-GPG-KEY-EPEL-6
[Root @ localhost ~] # yum -y install docker-io
Start and set at startup
[Root @ localhost ~] # service docker start
Starting cgconfig service: [OK]
Starting docker: [OK]
[Root @ localhost ~] # chkconfig docker on
Get cnetos Mirror
[Root @ localhost ~] # docker pull centos: latest
centos: latest: The image you are pulling has been verified
511136ea3c5a: Pull complete
5b12ef8fd570: Pull complete
34943839435d: Downloading [===>] 18.38 MB / 232.5 MB 1h7m49s
# Official installation docker docker pull imagename download from index center, imagename is the image name, such as docker pull Ubuntu is to download the base ubuntu and the tag is latest.
We can also search for Fedora and Ubuntu operating system based containers.
[Root @ localhost ~] # docker search ubuntu
[Root @ localhost ~] # docker search fedora
Docker View Mirror
[Root @ localhost ~] # docker images centos
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
centos latest 34943839435d Less than a second ago 224 MB
Run Run shell docker
[Root @ localhost ~] # docker run -i -t centos / bin / bash
[Root @ 2ce733141ece /] #
[Root @ 2ce733141ece /] #
[Root @ 2ce733141ece /] #
[Root @ 2ce733141ece /] #
Stop the container
[Root @ localhost ~] # docker stop < CONTAINER ID>
Remove all containers
docker rm $ (docker ps -a -q)
See docker sub-command, direct or complete knock docker docker help can
Common Commands
To summarize commonly used commands:
Where < > width up parameters is required, [] wide up is optional
See docker docker version version number, including client, server, and so dependent on the Go
docker info View System (docker) level information, including the management of images, containers and number
docker search image search in the docker index
docker pull docker registry server from the drop-down image
docker push a push to the image repository or registry
docker push: TAG above, specify the tag
docker inspect or see the underlying image information of container
docker images TODO filter out the intermediate image layers (intermediate image layers what is)
docker images -a list all images
docker ps default display the running container
docker ps -l displays the last created container, including not running
docker ps -a displays all container, including not running
See docker logs container logs, some of which is executing the command output
docker rm delete one or more container
docker rm `docker ps -a -q` remove all container
docker ps -a -q | xargs docker rm above, remove all container
docker rmi delete one or more image
docker start / stop / restart Start / Stop / Restart container
docker start -i to start a container and enter interactive mode
docker attach attach a running container
docker run using the image to create container and execute the appropriate command, and then stop
docker run -i -t / bin / bash to create a container using the image and enter interactive mode, login shell is / bin / bash
docker run -i -t -p container port will be mapped to the host port
docker commit [repo: tag] will solidify a container as a new image, behind the repo: tag optional
docker build
Looking Dockerfile under the path named path configuration files, use this profile to generate a new image
docker build -t repo [: tag] Ibid., you can specify the repo and optional tag
docker build - dockerfile using the specified configuration file, docker stdin way to get content, use this profile to generate a new image
See which docker port local port mapped to the designated container port, in fact, can be seen with a docker ps |
|
|
|