- Find
Command: Docker search [OPTIONS] Term
Related parameters:
Search the Docker Hub for images
--automated=false only show automated builds
--no-trunc=false Don ' t truncate output
-S,--stars=0 only displays with at least X stars
Example:
[[email protected] ~]# Docker search MySQL
NAME DESCRIPTION STARS Official automated
MySQL MySQL is a widely used, Open-source Relati ... 655 [OK]
Tutum/mysql MySQL Server image-listens in Port 3306 .... [OK]
Orchardup/mysql Notoginseng [OK]
Centurylink/mysql Image containing MySQL. Optimized to be Li ... [OK]
...................
- Get
Command: Docker pull [OPTIONS] Name[:tag]
Parameters:-A,--all-tags=false Download all tagged images in the repository
Example:
[email protected] ~]# Docker pull Tutum/mysql
Pulling Repository Tutum/mysql
26c0c52dc79a:pulling Dependent Layers
511136ea3c5a:download Complete
27d47432a69b:download Complete
5f92234dcf1e:download Complete
51a9c7c1f8bb:download Complete
5ba9dab47459:download Complete
D26d9affc74e:download Complete
C8420faa4614:download Complete
.........
- Run image
Command: Docker run-t-I Tutum/mysql/bin/bash
- View List
Command: Docker images [OPTIONS] [NAME]
Parameters
-A,--all=false Show all images (by default filter out the intermediate image layers)
-F,--filter=[] provide filter values (i.e. ' dangling=true ')
--no-trunc=false Don ' t truncate output
-Q,--quiet=false only show numeric IDs
Example
[email protected] ~]# Docker images-a
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
<none> <none> 6941BFCBBFCA days ago 0 B
Eric/ubuntu latest 52671e55fb86 6 weeks ago 270.3 MB
<none> <none> c8420faa4614 3 months ago 192.7 MB
<none> <none> d26d9affc74e 3 months ago 192.7 MB
<none> <none> 5ba9dab47459 3 months ago 192.7 MB
- Change tag
Before you change:
[email protected] ~]# Docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
CentOS 7 fd44297e2ddb days ago 229.6 MB
CentOS Centos7 fd44297e2ddb days ago 229.6 MB
CentOS latest Fd44297e2ddb days ago 229.6 MB
Eric/ubuntu latest 52671e55fb86 6 weeks ago 270.3 MB
Tutum/mysql latest 26c0c52dc79a 3 months ago 322.5 MB
Centos_6_5 ansible f01c1b138488 months ago 322.4 MB
chug/ubuntu12.10x64 latest 0B96C14DAFCD months ago 270.3 MB
Execute command:
Docker tag Tutum/mysql:latest Localrepo:newtag
After the change:
[email protected] ~]# Docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
CentOS 7 fd44297e2ddb days ago 229.6 MB
CentOS Centos7 fd44297e2ddb days ago 229.6 MB
CentOS latest Fd44297e2ddb days ago 229.6 MB
Eric/ubuntu latest 52671e55fb86 6 weeks ago 270.3 MB
Tutum/mysql latest 26c0c52dc79a 3 months ago 322.5 MB
Localrepo newtag 26c0c52dc79a 3 months ago 322.5 MB
Centos_6_5 ansible f01c1b138488 months ago 322.4 MB
chug/ubuntu12.10x64 latest 0B96C14DAFCD months ago 270.3 MB
- View Details
Command: Docker inspect [OPTIONS] container| IMAGE [container| IMAGE ...]
Parameter:-F,--format= "" Format the output using the given go template.
Example:
[email protected] ~]# Docker inspect f01c1b138488
- delete
Command: Docker RMI [OPTIONS] image [Image ...]
parameter:
-F,--force=false force removal of the image
--no-prune=false do not delete untagged parents
Example:
[[email protected] ~]# Docker RMI 26c
Error response from Daemon:conflict, cannot delete 26c0c52dc79a because the container 002ca178e599 are using it, use-f to Force
The reason for this error is that the image is being used by a 002ca178e599 container, so it cannot be deleted, so you first need to use Docker RM to delete the container and then delete it, and the associated aufs file will be deleted.
[[email protected] ~]# Docker RM 002
002
[email protected] ~]# Docker RMI 26c
Untagged:localrepo:newtag
Deleted:26c0c52dc79af8acf07a18cd1693bfae91926f496ee4d1c1dbe29a014394b7c0
Deleted:ba600267bf1a82675eeee78a2e18c49306c46888ca3cf33f372be4b80334d4f0
deleted:6d79a1795e744a9c2c4409526f90c9711d96d0e944a7f485fc31acf7e44fb210
deleted:cb6a06a808d4329b1bba405b9e3e733b1c379fb55979e8631e918f6c14c6023a
deleted:8d466d27bccad3502d579a2e0e6fc28fa8a46e32b5b453e7387a61eef7c1be8a
......
- Create
Because
- Create based on container
- Start a container
[email protected] ~]# Docker Run-ti F01/bin/bash
- Installing tools such as ansible,git in the boot container
- Query Container ID
[[email protected] ~]# Docker PS
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS N Ames
52ec71824717 centos_6_5:ansible "/bin/bash" to seconds ago up seconds High_mcclintock
- Executes the Create command, the return value is the generated image ID
[[email protected] ~]# Docker commit-m ' Ansible image,and git, sample yml files '-a ' Eric.sunah ' 52ec71824717 eric/ansibl E
6e3832e7c6e1aba47aefe1430c346a1dbf9a0454c37a907d293eaf7056d11d91
- View the new list
[email protected] ~]# Docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
eric/ansible latest 6e3832e7c6e1 2 minutes ago 629.7 MB
Eric/ubuntu latest 52671e55fb86 6 weeks ago 270.3 MB
Centos_6_5 ansible f01c1b138488 months ago 322.4 MB
chug/ubuntu12.10x64 latest 0B96C14DAFCD months ago 270.3 MB
- Save As
Command: Docker save [OPTIONS] image [Image ...]
Parameter:-O,--output= "" Write to a file, instead of STDOUT
Example:
Docker Save-o Centos6_ansible.tar eric/ansible
- Import
Command: Docker load [OPTIONS]
Parameter:-I,--input= "" Read from a tar archive file, instead of STDIN
Example:
Docker load--input Centos6_ansible.tar
- upload
First take an easy-to-identify tag
[[email protected] ~]# docker tag 6e38 sun7545526/template: Ansible
[[email protected] ~]# docker images
repository tag IMAGE id created VIRTUAL SIZE
sun7545526/template ansible 6e3832e7c6e1 minutes ago 629.7 MB
eric/ansible latest 6e3832e7c6e1 minutes ago 629.7 MB
Execute the upload command, the first time you upload will be asked to enter the user name, password, mailbox information:
[email protected] ~]# Docker push sun7545526/template:ansible
The push refers to a repository [sun7545526/template] (Len:1)
Sending image list
Pushing repository Sun7545526/template (1 tags)
511136ea3c5a:image already pushed, skipping
1d6ebc5c68b1:image already pushed, skipping
F01c1b138488:image already pushed, skipping
6e3832e7c6e1:image successfully pushed
Pushing tag for Rev. [6e3832e7c6e1] on {https://cdn-registry-1.docker.io/v1/repositories/sun7545526/template/tags/ Ansible}
Docker Usage Summary: Mirroring