I am running jenkins off of the official docker container for jenkins. And i have the following dockerfile
following the instructions at https://docs.docker.com/engine/installation/linux/debian/
FROM jenkins:2.32.1
# install docker inside this container
USER root
# Install Docker inside Jenkins
RUN apt-get update
RUN apt-get purge "docker.io*"
RUN apt-get update
RUN apt-get install -y apt-transport-https ca-certificates gnupg2
RUN apt-key adv \
--keyserver hkp://ha.pool.sks-keyservers.net:80 \
--recv-keys 58118E89F3A912897C070ADBF76221572C52609D
RUN echo "deb https://apt.dockerproject.org/repo debian-jessie main" > /etc/apt/sources.list.d/docker.list
RUN apt-get update
RUN apt-cache policy docker-engine
RUN apt-get update
RUN apt-get install -y docker-engine
RUN gpasswd -a jenkins docker
USER jenkins
Then i perform the following:
- build an image from this dockerfile
- run a container from the image
- execute bash in the container as root user
- run
sudo docker service start
in bash inside the container
Here is what i get:
root@1e0f4b325d58:/# sudo service docker start
mount: permission denied
rmdir: failed to remove ‘cpu’: Read-only file system
mount: permission denied
rmdir: failed to remove ‘cpuacct’: Read-only file system
mount: permission denied
rmdir: failed to remove ‘net_cls’: Read-only file system
mount: permission denied
rmdir: failed to remove ‘net_prio’: Read-only file system
/etc/init.d/docker: 96: ulimit: error setting limit (Operation not permitted)