Recently, I have been messing around with writing and deploying AWS Lambda Functions and Microsoft Azure Functions - two “serverless” technologies that have a lot of promise for certain applications.
For development environments, both rely on using docker images provided by the respective vendors to run your functions locally.
I attempted to set up Docker on Ubuntu 16.04 by running
sudo apt install docker,
which appeared to succeed.
However, when attempting to run
docker run hello-world - a command which
should pull a ‘hello world’ image from one of the public docker repositories,
then run it - I received an error to the effect of:
The solution to this problem is to either (a) run your docker commands as root, or (b) add your login user to the docker group.
Option (a) is not preferred, as introducing a sudo dependency will quickly lead you to ‘sudo hell’ where everything of use requires sudo.
For option (b), you can run
sudo usermod -a -G docker $USER, which will add your
user to the docker group.
For the change to take effect, you will need to fully log out of your account and log back in.