We are getting this error, when trying to run docker daemon inside the docker container (on AKS v 1.27.3). By following the stakoverflow ansswers [https://stackoverflow.com/questions/52973546/docker-in-docker-in-aks], [https://stackoverflow.com/questions/30984569/error-error-creating-aufs-mount-to-when-building-dockerfile#:~:text=with%20Raspberry%204-,Best%20way%20to%20do%20it..,-Check%20your%20docker].
By this, we could deploy the docker inside docker container of unbuntu:18.04.
But when we upgraded our ubuntu version to 22.04, the docker daemon is not getting started as part of the docker built container in execution.
Where as when we get inside the docker container and manually staring, it will start the container in second try.
How to resolve the issue.
Dockerfile as below
FROM ubuntu:22.04
#2-Enable Ubuntu Packages
ENV TARGETARCH="linux-x64"
ENV DEBIAN_FRONTEND=noninteractive
#install docker daemon inside docker
RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
RUN echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
RUN apt-get update
RUN apt-get install docker-ce docker-ce-cli containerd.io -y
.......
RUN az extension add --name azure-devops
WORKDIR /azp
COPY ./vstsagent/ .
COPY ./start.sh .
COPY ./docker.sh .
RUN chmod +x start.sh docker.sh
CMD ["./docker.sh"]
ENTRYPOINT ["./start.sh"]
docker.sh as below
#!/bin/bash
echo "DOCKER STARTS HERE"
service docker start
docker version
docker ps
echo "DOCKER ENDS HERE"
docker daemon.json as below
{
"storage-driver": "vfs"
}
#install docker latest version RUN curl -fsSL https://get.docker.com -o get-docker.sh && sh get-docker.sh
service
that don't usually work in containers). Can you restructure your application to not directly require access to a container engine? Or, failing that, can you use the Kubernetes API instead?