After installing docker-ce 25.0.0 when building Dockerimage, the container won't run because of ulimit error
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 6.1k
- Forks
- 2.2k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 43
Description
Description
Inside of my Dockerfile, which uses ubuntu:20.04, we install docker-ce. It is essential for us since we need to build AWS CDK code in a custom CodeBuild container.
Here's the Dockerfile code (simplified):
FROM ubuntu:20.04
RUN apt update -y; \
apt upgrade -y; \
apt install software-properties-common -y; \
apt update -y; \
apt install wget -y; \
apt install curl -y; \
apt-get install ca-certificates gnupg lsb-release -y; \
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg; \
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; \
apt-get update -y; \
apt install docker-ce -y; \
apt install unzip -y; \
service docker start; \
rm -rf /var/cache/apt;
ENTRYPOINT service docker start && /bin/bash
COPY install.py .
COPY remove.py .
The container was built successfully up until two days ago. On further investigation, I have found out that this is due to the Docker Engine upgrade to the 25.0.0 version.
If now we try docker run -t container, we get the following output (the same is printed when running service docker start while building the container:
service docker start /etc/init.d/docker: 62: ulimit: error setting limit (Invalid argument)
This is due to the line 62 in /etc/init.d/docker file which sets the ulimit hard limit:
ulimit -Hn 524288
Before the most recent 25.0.0 version release, it used to be the following line:
ulimit -n 1048576
When checking the /etc/security/limits.conf file inside of the Ubuntu image, I found out that the system hard limit is 100000.
If I remove the service docker start command from the Dockerfile (both in the RUN and ENTRYPOINT commands), the issue persists.
The only way I could make my image run is by hardcoding the previous version of docker-ce:
apt install docker-ce=5:24.0.7-1~ubuntu.20.04~focal -y
This has fixed the problem but is still a huge obstacle for us since we are now forced to use the older version of docker-ce and cannot get updates.
I hope this case will be helpful to anyone having the same problem as we did. I also hope a fix will be introduced so we could get the most recent updates on our image.
Reproduce
- Build an image using a Dockerfile and install the latest version of docker-ce.
- Try running the container
Expected behavior
We expected the container to work on 25.0.0 version of docker engine in the same way it did on 24.0.7
docker version
Not accessible since the container couldn't run.
The version being installed is 25.0.0
docker info
Not accessible since the container couldn't run.
Additional Info
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure with the provided Ubuntu 20.04 Dockerfile and docker-ce 25.0.0, then inspect line 62 of /etc/init.d/docker and compare it with the 24.0.7 behavior. Done means the container starts successfully on the current Docker Engine without the ulimit error while allowing Docker updates.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, ubuntu
- Domain
- devops
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100