Install docker
yum update
vim /etc/yum.repo.d/docker.repo
[dockerrepo]
name=Docker Repository
baseurl=https://yum.dockerproject.org/repo/main/centos/7/
enabled=1
gpgcheck=1
gpgkey=https://yum.dockerproject.org/gpg
yum install -y docker-engine
If the following error appears
Header V4 RSA / SHA512 Signature, key ID 2c52609d: NOKEY
computer open https://yum.dockerproject.org/gpg , download the PKI certificate file
vim /usr/local/docker.gpg
Copy the content of the locally downloaded certificate in the VIM editor and save it
rpm --import /usr/local/docker.gpg
yum install -y docker-engine
systemctl start docker.service
docker version
Common commands
View images mirror
docker ps
Start in background
docker run -d 名称
Restart the container
docker restart (containerid)
Stop docker
docker stop (containerid)
build
docker build -t jpress:latest .
Into the container
docker attach (containerid)
Exit container
ctrl+P+Q
Force delete docker image
docker rmi -f (imageid)
View logs
docker logs (containerid)
docker copy file to container
docker cp index.html [containerid]://usr/share/nginx/html
docker save changes
docker commit -m 'fun' [containerid]
docker commit -m 'fun' [containerid] [name]
docker delete
docker rmi [imageid]
Remove docker ps -a
docker ps -a
docker rm [containerid]
Install docker-compose
yum update
yum -y install epel-release
yum -y install python-pip
pip --version
pip install docker-compose
Common commands
Pull up
docker-compose up -d
stop
docker-compose stop
Remove
docker-compose rm
Construct
docker-compose build