Docker

Publish Date: Mar 15, 2017    Last Update: Oct 26, 2017

1. Prepare

Typically I need to do three things with docker:

  1. Installation. For Arch Linux, just install the docker package. For Ubuntu, use this link for guidance.

  2. Use docker from user. The key is to add user to the docker group

    sudo gpasswd -a user docker
    newgrp docker
    
  3. Change the docker image location. This is done by adding the -g argument to docker initiation. In ubuntu this is in the /etc/default/docker, while in Arch you need to add to the docker.service in /etc/systemd/system

Another way is to use a symlink to change the docker folder location.

2. Security

2.1 Secure port forwarding

By default, port-forwarding options will modify iptables directly, and therefore the ufw configurations will not be working anymore. To avoid such situations, we should limit the port forwarding to localhost only. We can then use ssh port forwarding for enhanced security.

  docker run -p 127.0.0.1:port1:port2 aa/bb

3. Services

I use docker for many services, including Rstudio-server, Jupyter Notebook, and Tiny Tiny RSS. You can easily google and find the appropriate container images to start these services.