For some reason it annoys some people to have to sudo every docker commands. I am not sure if it is the extra five characters, having occasionally to enter your password or constantly being reminded that your action might have consequences, that annoys these people.
There are some easy fixes to the part about typing (fixing people and their notions is infinitely harder), but there is a reason for it not being the default: being able to access the docker engine is effectively the same as being root (this article sums it all up pretty neatly), thus asking anyone doing so to actually be root first is prudent. But if this doesn’t bother you, read on.
Don’t confuse this with running docker containers; a lot of effort has gone into making containers safe to run. This is about access to the docker engine.
The first option is to add the user to the docker
group. This will allow the client to access the docker engine port directly. This is limited to docker and the docker engine, but there will be no logging of the commands as there will be with sudo.
The other option is to use the /etc/sudoers
to allow sudo to be used without password. Consider if this needs to be for all command, or if it should only allow passwordless sudo for running docker (and maybe a few other select commands).
If typing the five extra letters to prefix with sudo still annoys you, consider making an alias. See above mentioned article for details.
Or just use sudo -i
. You will still need to type your password once, but you will still be root after that telephone call or coffee break, and it will be obvious to anyone, including yourself, what is happening.