Alright, here we go:
- Grab this script:
wget https://johnnymatthews.dev/blog/2025-06-25-install-docker-on-ubuntu/install-docker.sh
- Give it executable permissions:
chmod +x install-docker-on-ubuntu.sh
- Run it:
./install-docker-on-ubuntu.sh
- Enable the new
docker
group that your user is now in:
newgrp docker
But Johnny, why do I have to run that
newgrp
thing after the script? Why not just add that into the script itself!
You can run newgrp docker
at the end of the script, but shit won’t do what you think it’ll do. When you run newgrp
in a script, it starts a new shell with the docker group active, but this new shell is confined to the script’s execution context. Once the script ends, you get kicked out to your original shell session where the group change isn’t active.
Anyway, that’s everything. Be gone.