Docker

From Ever changing code
Revision as of 09:48, 1 September 2016 by Pio2pio (talk | contribs) (Created page with "Containers taking a world J = Installation = To install the latest version of Docker with curl: $ curl -sSL https://get.docker.com/ | sh Add your user to docker ''group'' to...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Containers taking a world J

Installation

To install the latest version of Docker with curl:

$ curl -sSL https://get.docker.com/ | sh

Add your user to docker group to be able to run docker commands without need of sudo

sudo usermod -aG docker yourusername

HTTP proxy

Configure docker if you run behind a proxy server. In this example CNTLM proxy runs on the host machine listening on localhost:3128. This example overrides the default docker.service file by adding configuration to the Docker systemd service file.

First, create a systemd drop-in directory for the docker service:

mkdir /etc/systemd/system/docker.service.d

Now create a file called /etc/systemd/system/docker.service.d/http-proxy.conf that adds the HTTP_PROXY environment variable:

[Service]
Environment="HTTP_PROXY=http://proxy.example.com:80/"

If you have internal Docker registries that you need to contact without proxying you can specify them via the NO_PROXY environment variable:

Environment="HTTP_PROXY=http://proxy.example.com:80/" "NO_PROXY=localhost,127.0.0.1,docker-registry.somecorporation.com"

Flush changes:

$ sudo systemctl daemon-reload

Verify that the configuration has been loaded:

$ systemctl show --property=Environment docker
Environment=HTTP_PROXY=http://proxy.example.com:80/

Restart Docker:

$ sudo systemctl restart docker

References