docker and use common commands


docker mirroring commands:
1. View Mirror (local):
docker ImagesRF Royalty Free
docker ImagesRF Royalty Free -q # to view mirrors of all the above mentioned id
2. Search Mirror:
docker Search the mybatis or docker search mysql: version
3. Pull the mirror:
docker pull the mybatis ( Download the latest) or docker pull mysql: version
4. Remove mirror:
Docker rmi rmi MySQL image_id or Docker: 5.7
Docker Docker ImagesRF Royalty Free rmi -q # delete all local mirror

docker container-related commands:
1. Check the container:
docker PS # View the running container
docker ps -a # View all containers
2. Create a container:
docker RUN Parameter
Parameter Description:
-i: Keep container operation. After commonly used with -t, -it was added two parameters, automatically created after the container into the container, after (exit command) to exit the container, closing the container automatically
-t: reassign a pseudo input terminal is a container, generally -i use
-d: run vessel conservative (background) mode. Create a container to run in the background, use docker exec command into the container, after exiting the container, the container does not automatically close
the container -it created commonly referred to as an interactive container, -id create containers commonly referred to as the guardian of container
--name : named container created.
For example: docker run -it --name = c1 centos : 7 / bin / bash # Create initialization command into the container and the container
exit the container: Exit
3. enter the vessel:
Docker Exec exit parameter # container, the container will not close
Example: docker exec c1 -it / bin / bash
4. stop container:
Docker sTOP container name
5. start container:
Docker start container name
6. Remove the container: If the container is running the state fails to delete, you can remove the need to stop the container
docker rm container or container name id
7. Check container information:
docker Inspect container name

data volume containers docker: between the container and implemented, the container and external data file interaction
Configuration data volume
container is created, the data volume using the -v parameter setting
docker RUN .. .-v host directory (file): the container directory (file)
Note:
1) directory must be an absolute path
2) if the directory does not exist, is automatically created
3) can be mounted a plurality of data volumes
example: docker run - it --name = c1 -v / root / data: root / data_contrainer centos: 7 / bin / bash

Data volume container:
1. Create starting c3 data volume, using the -v parameter setting data volume
docker run -it --name = c3 -v / volume centos: 7 / bin / bash # / volume is a data volume in the data volume container address (directory)
2. Create c1 and c2 container, --volumes-from parameter setting data volume
Docker Expediting IT RUN -volumes --name = c1-C3 CentOS from:. 7 / bin / the bash
Docker RUN Expediting --name = c2 -volumes-from c3 centos: 7 / bin / bash
Note: You can view the container inspect directory name command to the data volume of each container by the host docker and
the data volume of the heald summary:
1) the concept of data volume: the host a directory or file
2) data role:
container data persistence
client and container data exchange
between data exchange container
3) container volume data:
create a container, mount a directory, so that other container inherited from the container (--volumes -from)
for data volume configuration by short-answer mode

Guess you like

Origin www.cnblogs.com/wsy0202/p/12501183.html