This document describes the steps for setting up docker and docker-compose on a Linux system. It supports Ubuntu and CentOS like flavors.

  1. Create a file /var/tmp/init-docker.sh with the following contents

    init-docker.sh

  2. Run this file with as a non-root user who can has sudo privileges

    ./init-docker.sh
    
  3. Enable docker to run at startup

    1. Ubuntu

      systemctl --user enable docker
      
    2. Centos / Amazon Linux

      sudo service docker start
      sudo chkconfig docker on
      

Optional hardening steps

Enable/disable user lingering for one or more users. If enabled for a specific user, a user manager is spawned for the user at boot and kept around after logouts. This allows users who are not logged in to run long-running services. Takes one or more user names or numeric UIDs as argument. If no argument is specified, enables/disables lingering for the user of the session of the caller.

sudo loginctl enable-linger $(whoami)