Use docker on nixos
1 Why
If you are a developer, you will definitely need to use Docker at one time or
another. If you are on nixos, you might have postponed this step for as long as
I did, but time will come when you will want to do it in nixos also :) I
actually would have lived happily without docker on nixos for longer, but I had
to use act
for testing out github actions locally, so Docker was it's
prerequisite.
So let's see how I installed Docker on NixOS.
2 How
Actually it was easier than expected.
There is a great docs page - https://nixos.wiki/wiki/Docker
The only things I did was:
# install docker virtualisation.docker.enable = true; users.extraGroups.docker.members = [ "yournixosusername" ];
Did:
sudo nixos-rebuild switch
,- rebooted the system for group changes to take effect with
sudo reboot
- checked if my user belongs to docker group with
groups
- then finally the docker status
docker ps
,docker images
- last confirmation that you can read the docekr status -
sudo systemctl status docker
When I saw that they do,I tried these steps of Docker test container creation.
When this worked also, I knew I am set and ready to work with Docker from inside of nixos.