Skip to content

Docker and Docker Compose

ronnylov edited this page Jun 17, 2019 · 4 revisions

Installation

On debian Linux we install docker and docker-compose by following official docker documentation. Take a look at the docker documentation how to install Docker CE on debian. Install Docker CE as described there.

You need to do the post-installation steps for Linux. The steps can be summarized as:

$ sudo groupadd docker
$ sudo usermod -aG docker lthn
$ sudo systemctl enable docker

They also have instructions about how to install Docker Compose. Click on the Linux tab at "Install Compose" section to see instructions how to do it on Linux. Install docker-compose according to their instructions.

Disable docker iptables and IPv6 support

Docker have its own mamagement of iptables firewall which is in conflict with our own customized iptables firewall setup. To get full contol over iptables we must disable iptables management by docker. IPv6 support seems to be disabled by default in docker but to be sure we add this to configuration too.

Docker official documentation Docker and iptables.

To prevent Docker from manipulating the iptables policies at all, set the iptables key to false in /etc/docker/daemon.json. This is inappropriate for most users, because the iptables policies then need to be managed by hand.

Well it is not inappropriate for us because we want to manage iptables by hand.

Take a look at docker documentation how to Enable IPv6 support, but we do it the other way around and disable it.

So we use nano editor to create the /etc/docker/daemon.json file:

$ sudo nano /etc/docker/daemon.json

Make the file look like this:

{
  "ipv6": false,
  "iptables": false
}

Save the file in nano with Ctrl-O and exit Ctrl-X

Reboot and test Docker

sudo reboot

Wait for the server to reboot and then login as lthn user.

Verify that Docker CE is installed correctly by running the hello-world image.

$ docker run hello-world

This command downloads a test image and runs it in a container. When the container runs, it prints an informational message and exits.