-2

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

3
  • @iamattiq1991 can you check above
    – Vowneee
    Commented Jul 8 at 17:36
  • A Kubernetes Node is not necessarily running a Docker daemon, and given the security concerns around using the Docker API (it is trivial to use it to root the entire host) I would not expect it to be available. The Docker daemon is pretty complex to set up and you can't "just" run it in a container (especially not via commands like 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?
    – David Maze
    Commented Jul 8 at 18:07
  • By following the given documents, we were able to run the docker daemon in ubuntu 18.04, but not working the same in ubunt22.04 container. Also the manual restart of docker service within the created container is working for ubuntu22.04. So that means its not the problem with the dockerdemon issue within the ubuntu22.04, But some other issue
    – Vowneee
    Commented Jul 9 at 14:48

0

Browse other questions tagged or ask your own question.