cockroachdb / cockroachdb/cockroach
File descriptors limit is smaller than the minimum in the Docker Image
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
**Describe the problem**
I was following the [documentation to launch a single node cluster](https://www.cockroachlabs.com/docs/v23.2/start-a-local-cluster-in-docker-mac#start-a-single-node-cluster) using docker, and its returning an error complaining about the limit of the file descriptions, saying that it is **1024** while the minimum is **1956**.
```
[kepler@CoreOS-01 ~]$ docker network create -d bridge roachnet
[kepler@CoreOS-01 ~]$ docker volume create roach-single
[kepler@CoreOS-01 ~]$ docker run --env COCKROACH_DATABASE=test-db --env COCKROACH_USER=test-user --env COCKROACH_PASSWORD=test-passwd --name=roach-single --hostname=roach-single --net=roachnet -p 26257:26257 -p 8080:8080 -v "roach-single:/cockroach/cockroach-data" cockroachdb/cockroach:latest start-single-node --insecure --http-addr=localhost:8080
*
...
initiating graceful shutdown of server
too early to drain; used hard shutdown instead
*
* ERROR: ERROR: server startup failed: failed to start server:
* failed to create engines: hard open file descriptor limit of 1024 is under the minimum required 1956
* please see https://www.cockroachlabs.com/docs/v23.1/recommended-production-settings.html for more details
*
```
**To Reproduce**
I launched a bash session inside the docker image to check it, by using:
```
[kepler@CoreOS-01 ~]$ docker run -it cockroachdb/cockroach:latest bash
```
and the limit of open files in indeed defined as 1024:
```
[root@53f48dd7aafb cockroach]# ulimit -a
core file size (blocks, -c) unlimited
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 19291
max locked memory (kbytes, -l) 8192
max memory size (kbytes, -m) unlimited
open files (-n) 1024 <--- HERE
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) unlimited
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
```
I cannot change the limit, the issue should be addressed in the Dockerfile in my opinion.
```
[root@53f48dd7aafb cockroach]# ulimit -n 4096
bash: ulimit: open files: cannot modify limit: Operation not permitted
```
**Environment:**
- CockroachDB version [dockerhub latest -> cockroachdb/cockroach:latest]
- Server OS: [Fedora CoreOS 39]
Jira issue: CRDB-35781
Contributor guide
Assessment
This issue has not been assessed yet.