Setting up Docker on Ubuntu
- Get link
- X
- Other Apps
- Update the apt cache and install
curl
sudo
apt-get update -y
sudo
apt install curl
- Setup proxy servers in ~/.bashrc
export
http_proxy=http://<proxy-server>:<port>
export
https_proxy=http://<proxy-server>:<port>
- Add GPG key
curl
-fsSL https://download.docker.com/linux/ubuntu/gpg |
sudo apt-key add -
- Install Docker
sudo
apt install docker.io
- Setup proxy (instructions from https://docs.docker.com/config/daemon/systemd/#httphttps-proxy)
- Create a systemd drop-in directory
for the docker service:
sudo mkdir -p /etc/systemd/system/docker.service.d
- Create a file
named /etc/systemd/system/docker.service.d/http-proxy.conf that
adds the HTTP_PROXY environment variable:
[Service]
Environment="HTTP_PROXY=http://<proxy-server>:<port>"
Environment="HTTPS_PROXY=http://<proxy-server>:<port>"
- Flush changes and restart Docker:
sudo systemctl daemon-reload
sudo systemctl restart docker
- Verify
sudo systemctl show --property=Environment
docker
- For docker build, see https://dev.to/zyfa/setup-the-proxy-for-dockerfile-building--4jc8
for proxy settings. Two options:
docker build --build-arg http_proxy=http://<proxy-server>:<port>
--build-arg https_proxy=http://<proxy-server>:<port> .
You also can set the proxy in the Dockerfile.
ENV http_proxy <proxy-server without http prefix>:<port>
- Get link
- X
- Other Apps
Comments
Post a Comment