I have created a Self Hosted Docker container agent in Azure DevOps.
Now, in Azure DevOps. I have created a pipeline and I am using the Self Hosted COntainer Agent to execute the docker run command. On trying that I am getting an error stating docker daemon is not running.
Post that I tried to execute sudo systemctl enable docker; sudo systemctl start docker; etc. but unfortunately, this did not work as I was asked for a password.
Please let me know if more clarity is needed.
Running Docker commands inside a container to manage other containers is known as Docker Inside Docker (DinD), both containers should use host's daemon which is mentioned in official link.
To achieve this, you can mount the Docker socket (usually located at /var/run/docker.sock) into your container. This allows the container to communicate with the Docker daemon on the host.
To start the agent:
You can check the links below for more details:
Self-hosted Azure DevOps agents running in Docker
Running Docker commands inside Docker containers (on Windows)