Docker basic use on Linux

 

Installation environment (Linux)

View centos version: uname -r

Docker requirements CentOS system kernel version is higher than 3.08

Upgrade package and kernel: yum update

Installation Docker

Installation: yum  install docker 

start docker: systemctl start docker 

query docker version: docker - v 

will docker service to boot: systemctl enable docker 

stop docker: systemctl stop docker

 


Common operations:

  1, the mirror operation

Retrieval: docker search keywords such as: docker search redis 
pull: docker pull mirroring name: tag: tag is optional, tag represents the label, multi-version software, the default is the latest 
list: docker images (query all local mirror) 
delete: Docker rmi Image - the above mentioned id (delete the specified local mirror)

 

  2, container operations

Run : docker run --name container-name -d
Description: -name: custom container name
    -d: background
    image-name: Specifies the mirror template
example: docker run --name myredis -d redis

List : docker ps (container queries running)
Note: You can view all the -a container

Stop: docker stop container-name / container -id
Description: Stop your vessel is currently running

Start : docker start container-name / container
Description: starting container

Delete : docker rm container-id
Description: Removes the specified container

Port Mapping : -p 6379: 6379
Description: -p: internal host port (mapping) of the container port
, for example: docker run -d -p 6379: 6379
example: docker run -d -p 8080: 8080 tomcat
example: docker run -e ES_JAVA_OPTS = "-


Container log : docker logs container-name / container


Firewall status query: service firewalld status
turn off the firewall: service firewalld stop

Guess you like

Origin www.cnblogs.com/zyulike/p/11256933.html