Preparation

Security: Creating a docker group instead of using root or sudo

Every effort should be made to ensure that you are running Docker containers in the most secure manner. To start, make let’s get Docker setup so we can utilize docker as the user we are logged on as instead of using sudo or running as user root.

Open a terminal and add the group docker:

sudo groupadd docker

Add the current user to the docker group:

sudo usermod -aG docker $USER

Test:

docker run hello-world

If you get the message below, you will need to logout and log back in as the current user:

docker: Cannot connect to the Docker daemon. Is the docker daemon running on this host?. See 'docker run --help'.

If you still receive the message, open a terminal and unset the environment variable $DOCKER_HOST:

unset $DOCKER_HOST

Log out and log back in as the current user. If you still receive the same message try to ensure the docker service is running:

sudo service --status-all | grep -i docker

If it is not runnin, start the docker service by entering:

sudo service docker start

Alternatively, if it is running you can bounce the service by entering:

sudo service docker start

List Docker Images

In a terminal window type:

docker images

This is a screenshot of the Docker images available within Mercenary-Linux:

Is that all there is to Docker?

There is so much more that you can learn about Docker and in the future there will be more content related to Docker in this documentation. However, for now if you want to learn more about Docker please visit the resources below.

results matching ""

    No results matching ""