Skip to content

Installation

Installation

Desktop (Fedora)

Official Documentation for Fedora

Be sure to remove older verions of Docker before continuing.

Add the DNF repository for Fedora

sudo dnf config-manager \
    --add-repo \
    https://download.docker.com/linux/fedora/docker-ce.repo

This will use the stable version of Docker, you can also use the bleeding edge version as well.

sudo dnf config-manager --set-enabled docker-ce-edge

Now you can install the Docker CE package

sudo dnf install docker-ce

You may be prompted to accept a GPG key, accept to continue.

LXC Container (CentOS)

Here are the instructions to install Docker inside an LXC container (running CentOS)

Outside the Container:

Run the following on the container host (your desktop etc)

Note

The below assumes you are running an Edmonds Commerce desktop machine with LXC aliases configured For standard LXC, commands should be sudo lxc-{cmd} -n $containerName

#Specify your container name:
containerName="your-container-name"

#Stop the container if its running
lxc-stop "${containerName}"

#Updating container config to allow dockers
sudo bash -c "
echo '

# Allow running Docker inside LXC
lxc.aa_profile = unconfined
lxc.cgroup.devices.allow = a
lxc.cap.drop =

' >> /var/lib/lxc/$containerName/config
"

#Restart container
lxc-start "${containerName}"

#Enter the container
lxc-attach "${containerName}"

Inside the Container:

Run the following inside the container to install and confirm Docker is running:

#Become root
sudo bash

#Install dependencies and tools
yum install -y yum-utils \
  device-mapper-persistent-data \
  lvm2

#Add repo
yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo

#Install
yum install docker-ce
systemctl enable docker
systemctl start docker

#Stop being root
exit

#Add docker group to normal user
sudo bash -c "groupadd docker; usermod -aG docker $USER"

#Reload groups
exec su -l $USER

#Start Docker Hello World
docker run hello-world

Further Reading

Configuration

Now that you have Docker installed, there are a few extra steps to ensure things run smoothly.

Enable and start the Systemd Docker Service

sudo bash -c "systemctl enable docker; systemctl start docker"

Add your user to the Docker group

Unless you intend to run all your containers as root, it is recommended that you add your user account to the group. This will require that you log out and back in to Linux to update your user session.

sudo bash -c "groupadd docker; usermod -aG docker $USER"

If you are impatient and want to test without logging out and back in, you can run your terminal in root and switch user. This should still have the desired effect but can be cumbersome if you open and close terminals frequently.

groups;
sudo bash
su <yourusername>
groups;

This will cause that instance of the terminal to have the updated session. The group commands should tell you if you have joined the group correctly.

Test Docker is working correctly

Once you have dealt with your user and the docker group, run the test Docker image. You should be able to run the command if you have set up your user and group correctly, if it only works as root then you may need to log out and back in again.

docker run hello-world

You should see the message Hello from Docker! along with some more text.