Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No ulimit validation in the daemon.json #40245

Open
fanjiyun opened this issue Nov 25, 2019 · 0 comments
Open

No ulimit validation in the daemon.json #40245

fanjiyun opened this issue Nov 25, 2019 · 0 comments

Comments

@fanjiyun
Copy link
Contributor

fanjiyun commented Nov 25, 2019

Description
I found that there was no ulimit validation in the daemon.json, but the dockerd flag has. Why? Are there any special considerations?

Steps to reproduce the issue:

  1. Set up the daemon.json as follows. ulimit soft limit is greater than hard limit.
$ cat /etc/docker/daemon.json
{
    "default-ulimits": {
         "core": {
             "Name": "core",
             "Soft": 2048,
             "Hard": 1024
        }
    }
}
  1. Start the docker service. Service started successfully.
$ systemctl restart docker
$ systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
   Active: active (running) since Mon 2019-11-25 19:58:39 CST; 7s ago
     Docs: https://docs.docker.com
 Main PID: 30454 (dockerd)
    Tasks: 44
   Memory: 41.9M
   CGroup: /system.slice/docker.service
           └─30454 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
  1. Stop the docker service. Then, start docked in the following ways, but docked fails to start.
$ dockerd --default-ulimit core=2048:1024
Status: invalid argument "core=2048:1024" for "--default-ulimit" flag: ulimit soft limit must be less than or equal to hard limit: 2048 > 1024
See 'dockerd --help'., Code: 125
  1. Set up the daemon.json as follows. "coxxre" is an invalid ulimit type.
$ cat /etc/docker/daemon.json
{
    "default-ulimits": {
         "coxxre": {
             "Name": "coxxre",
             "Soft": 1024,
             "Hard": 2048
        }
    }
}
  1. Start the docker service. Service started successfully.
$ systemctl restart docker
$ systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
   Active: active (running) since Mon 2019-11-25 19:57:12 CST; 5s ago
     Docs: https://docs.docker.com
 Main PID: 29960 (dockerd)
    Tasks: 37
   Memory: 41.7M
   CGroup: /system.slice/docker.service
           └─29960 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
  1. Stop the docker service. Then, start docked in the following ways, but docked fails to start.
$ dockerd --default-ulimit coxxre=1024:2048
Status: invalid argument "coxxre=1024:2048" for "--default-ulimit" flag: invalid ulimit type: coxxre
See 'dockerd --help'., Code: 125

Describe the results you received:
As shown above.

Describe the results you expected:
Perhaps, the best result is that docker service fails to start (similar to docked flag) when the invalid ulimit is set in the daemon.json,

Output of docker version:

# docker version
Client: Docker Engine - Community
 Version:           19.03.5-rc1
 API version:       1.40
 Go version:        go1.12.12
 Git commit:        3e40132
 Built:             Wed Nov  6 07:29:27 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.5-rc1
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.12
  Git commit:       3e40132
  Built:            Wed Nov  6 07:28:04 2019
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.2.8
  GitCommit:        a4bc1d432a2c33aa2eed37f338dceabb93641310
 runc:
  Version:          029124da7af7360afa781a0234d1b083550f797c
  GitCommit:        029124da7af7360afa781a0234d1b083550f797c
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant