Install Docker and Docker Compose on CentOS - chaitanyavangalapudi/devops-scripts GitHub Wiki

Install Docker

If your machine is behind corporate firewall, run below commands to export proxy environment variable This is for user: username, password: passwd123$

export http_proxy=http://username:passwd123\[email protected]:8080
export https_proxy=http://username:passwd123\[email protected]:8080

Run below commands to install docker:

yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum-config-manager --enable docker-ce-edge
yum-config-manager --enable docker-ce-testing
yum makecache fast
yum install docker-ce docker-ce-cli containerd.io -y
systemctl start docker
systemctl enable docker
docker --version
systemctl statu docker

Install Docker-Compose

curl -L "https://github.com/docker/compose/releases/download/1.24.0/docker-compose-$(uname -s)-$(uname -m)"  > /usr/bin/docker-compose
chmod +x /usr/bin/docker-compose

Follow the matrix specified at https://github.com/docker/compose/releases to install docker-CE version and corresponding docker-compose version accordingly.

Change the version of Docker-Compose specified above (1.24.0) as required.

Configure Docker to use HTTP Proxy

If your machine is behind corporate proxy, you need to configure HTTP Proxy on both Nexus OSS and your Client. You can configure HTTP Proxy on client by editing http-proxy.conf under /etc/systemd/system/docker.service.d/

[root@localhost /]# cat /etc/systemd/system/docker.service.d/http-proxy.conf
[Service]
Environment="HTTP_PROXY=http://user:[email protected]:8080"
Environment="HTTPS_PROXY=http://user:[email protected]:8080"
Environment="NO_PROXY=localhost,127.0.0.1"

Restart Docker

After this, restart the docker daemon on your machine by running below commands so that proxy changes are applied.

sudo systemctl daemon-reload
sudo systemctl restart docker

References: