Skip to content
Menu
i do, therefore i am
  • Home
  • Blog
  • Contact us
i do, therefore i am
September 14, 2022November 7, 2022

Run docker as non-root

After installing docker, you may encounter that your commands fail with a “permission denied” message when trying to run them as a non-root user:

my_user@my_docker_host$ docker build -t my_image .
Got permission denied while trying to connect to the Docker daemon socket at ... 

The same command succeeds when run as root, but that is nothing to write home about. Root can do anything.

Docker’s official documentation addresses this problem at:

https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user

But if you are like me, you either did not read it or you did and the forgot it … again. No problem, you need to:

  • Create a docker group.
sudo groupadd docker
  • Add your user to the docker group.
sudo usermod -aG docker $USER

Logout and login again, or activate the changes by typing this:

 newgrp docker

IMPORTANT: If running on a virtual machine, you may have to restart the virtual machine for the changes to take effect. Yes, it’s in the official documentation, but I did not see it.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • vim as Hex-Editor
  • installing pico-sdk in wsl
  • A WordPress theme from scratch 5
  • A WordPress theme from scratch 4
  • Serial Port Windows

Recent Comments

    Archives

    • May 2023
    • January 2023
    • November 2022
    • October 2022
    • September 2022
    • May 2022
    • April 2022
    • March 2022
    • February 2022
    • January 2021

    Categories

    • Fortran
    • linux
    • Postgresql
    • Programming
    • Python
    • Tools, tips and tricks
    • Wordpress

    Meta

    • Log in
    • Entries feed
    • Comments feed
    • WordPress.org

    Postgres

    • postgres-docs

    Python

    • data model
    • the standard library
    • python tips
    • import system
    • asyncio
    • built-in functions

    Open_VMS

    • lexicals at marc’s place
    • documentation and manuals
    • system services
    • rms services reference
    ©2025 i do, therefore i am | Powered by WordPress and Superb Themes!