I am using Docker version 20.10.17, build 100c701, on Ubuntu 20.04.4.
I have successfully created a jenkins/jenkins:lts image with its own volume, using the following command:
docker run -p 8082:8080 -p 50001:50000 -d -v jenkins_home:/var/jenkins_home jenkins/jenkins:lts
But after installing many plugins and running many jobs on Jenkins, I kept getting a notification on the Jenkins GUI that the storage is almost full (it was almost 388 Mb).
1- What is the default size of a docker volume ? I couldn’t find an answer anywhere.
2- I tried to specify the size of the volume (after deleting everything image/container/volume) using the driver_opts and using a docker compose file.
The docker-compose.yml file.
version: '3'
services:
jenkins:
build:
context: .
dockerfile: ./Dockerfile
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- jenkins_home:/var/jenkins_home
ports:
- 8082:8080
- 50001:50000
volumes:
jenkins_home:
driver_opts:
o: "size=900m"
The Dockerfile.
FROM jenkins/jenkins:lts
USER root
RUN apt-get -y update && apt-get install -y lsb-release &&\
apt-get -y install apt-transport-https ca-certificates
RUN apt-get -y install curl && \
apt-get -y update && \
apt-get -y install python3.10
RUN curl -fsSLo /usr/share/keyrings/docker-archive-keyring.asc \
https: //download.docker.com/linux/debian/gpg
RUN echo "deb [arch=$(dpkg --print-architecture) \
signed-by=/usr/share/keyrings/docker-archive-keyring.asc] \
https ://download.docker.com/linux/debian \
$(lsb_release -cs) stable" > /etc/apt/sources.list.d/docker.list
RUN apt-get -y update && \
apt-get -y install docker-ce docker-ce-cli containerd.io docker-compose-plugin
USER jenkins
I got an error that the required device option is not specified.
I don’t want a temporary storage tmpfs, so i tried to specify a path on my machine. I got the error that there is no such device.
What am I doing wrong? How should I proceed?
My final target is to create a Jenkins container that has a large volume size.