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 PackagesENV TARGETARCH="linux-x64"ENV DEBIAN_FRONTEND=noninteractive#install docker daemon inside dockerRUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpgRUN 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/nullRUN apt-get updateRUN apt-get install docker-ce docker-ce-cli containerd.io -y.......RUN az extension add --name azure-devopsWORKDIR /azpCOPY ./vstsagent/ .COPY ./start.sh .COPY ./docker.sh .RUN chmod +x start.sh docker.shCMD ["./docker.sh"]ENTRYPOINT ["./start.sh"]
docker.sh as below
#!/bin/bashecho "DOCKER STARTS HERE"service docker startdocker versiondocker psecho "DOCKER ENDS HERE"
docker daemon.json as below
{"storage-driver": "vfs"}
#install docker latest versionRUN curl -fsSL https://get.docker.com -o get-docker.sh && sh get-docker.sh