Skip to main content

Docker study(1)- Initial install

·108 words·1 min
Docker
Rory
Author
Rory
Step by step the ladder is ascended
Reference:https://docs.docker.com/engine/install/centos/ https://docs.docker.com/config/daemon/systemd/#httphttps-proxy https://www.runoob.com/docker/docker-tutorial.html

Centos Docker install
#

[root@localhost ~]# yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
[root@localhost ~]# sudo yum-config-manager --enable docker-ce-nightly
[root@localhost ~]# sudo yum-config-manager --enable docker-ce-test
[root@localhost ~]# yum install docker-ce docker-ce-cli containerd.io
[root@localhost ~]# systemctl start docker
[root@localhost ~]# systemctl status docker
[root@localhost ~]# docker info
[root@localhost ~]# docker run hello-world

HTTP/HTTPS proxy
#

[root@localhost ~]#sudo mkdir -p /etc/systemd/system/docker.service.d
[root@localhost ~]#vi /etc/systemd/system/docker.service.d/http-proxy.conf
[Service]
Environment="HTTP_PROXY=http://xxx:80"
Environment="HTTPS_PROXY=http://xxx:80"
Environment="NO_PROXY=localhost,127.0.0.1,.cisco.com"
[root@localhost ~]#sudo systemctl daemon-reload
[root@localhost ~]#sudo systemctl restart docker
[root@localhost ~]#sudo systemctl show --property=Environment docker
[root@localhost ~]#docker run hello-world

Attach Docker
#

  • docker attach
  • docker exec, recommend use this command
[root@localhost ~]# docker exec --help
[root@localhost ~]# docker exec -it 35cd76f9a02d /bin/bash
root@35cd76f9a02d:/var/www/html#