Installing docker-ce as part of Dockerfile, with below command:
ARG DOCKER_VERSION=18.06.1~ce~3-0~debian
RUN apt-get update && \
apt-get -y install apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common && \
curl -fsSL https://download.docker.com/linux/$(. /etc/os-release; echo "$ID")/gpg > /tmp/dkey; apt-key add /tmp/dkey && \
add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/$(. /etc/os-release; echo "$ID") \
$(lsb_release -cs) \
stable" && \
apt-get update && \
apt-get -y install docker-ce=${DOCKER_VERSION:-18.06.1~ce~3-0~debian}
gives below messages:
Setting up docker-ce (18.06.1~ce~3-0~debian) ...
Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /lib/systemd/system/docker.service.
Created symlink /etc/systemd/system/sockets.target.wants/docker.socket → /lib/systemd/system/docker.socket.
invoke-rc.d: could not determine current runlevel
invoke-rc.d: policy-rc.d denied execution of start.
Is invoke-rc.d: could not determine current runlevel an issue to not determine the runlevel?
You are trying to run
Docker in Docker. That is very advanced hackish approach and you should read more about it, e.g. old blogpost https://jpetazzo.github.io/2015/09/03/do-not-use-docker-in-docker-for-ci/.I guess you will want to install only docker client (not a daemon) in the image, which will connect to docker daemon of host OS.