cli
cli copied to clipboard
Accept --entrypoint=["some","argument"] for create/run command
Description
Hi,
It seems for now --entrypoint=argument can only specify a single argument string. It would be cool if we were able to specify a multiple arguments json array, like in a Dockerfile. Podman already supports this json array syntax.
Reproduce
> docker run -t -i --rm --entrypoint='["python3","--version"]' quay.io/fedora/fedora
docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "[\"python3\",\"--version\"]": executable file not found in $PATH: unknown.
Expected behavior
It works fine (ie runs python3 --version
like it does with podman:
> podman run -t -i --rm --entrypoint='["python3","--version"]' quay.io/fedora/fedora
Python 3.12.0
docker version
Client:
Version: 25.0.2
API version: 1.43 (downgraded from 1.44)
Go version: go1.21.6
Git commit: 29cf629
Built: Thu Feb 1 00:22:06 2024
OS/Arch: linux/amd64
Context: default
Server: Docker Engine - Community
Engine:
Version: 24.0.6
API version: 1.43 (minimum version 1.12)
Go version: go1.20.7
Git commit: 1a79695
Built: Mon Sep 4 12:31:49 2023
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.24
GitCommit: 61f9fd88f79f081d64d6fa3bb1a0dc71ec870523
runc:
Version: 1.1.9
GitCommit: v1.1.9-0-gccaecfc
docker-init:
Version: 0.19.0
GitCommit: de40ad0
docker info
Client:
Version: 25.0.2
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.12.1
Path: /usr/libexec/docker/cli-plugins/docker-buildx
Server:
Containers: 9
Running: 6
Paused: 0
Stopped: 3
Images: 80
Server Version: 24.0.6
Storage Driver: overlay2
Backing Filesystem: xfs
Supports d_type: true
Using metacopy: false
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: systemd
Cgroup Version: 2
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 61f9fd88f79f081d64d6fa3bb1a0dc71ec870523
runc version: v1.1.9-0-gccaecfc
init version: de40ad0
Security Options:
seccomp
Profile: builtin
cgroupns
Kernel Version: 5.14.0-362.8.1.el9_3.x86_64
Operating System: Red Hat Enterprise Linux 9.3 (Plow)
OSType: linux
Architecture: x86_64
CPUs: 12
Total Memory: 31.05GiB
Name: nceswbbaprd1320.rnd.amadeus.net
ID: 2cdf1796-faae-40cd-8ece-afacd1c5b2d9
Docker Root Dir: /var/lib/docker
Debug Mode: false
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Default Address Pools:
Base: 10.225.0.0/16, Size: 24
Additional Info
No response
What is the use case for this?
You can do docker run --entrypoint python3 quay.io/fedora/fedora --version
I'm not quite sure why people really use --entrypoint
at all except to overwrite what's in the image.
The image may define both an ENTRYPOINT
and CMD
and in this case you might want to override just the entrypoint while keeping the default CMD
. This custom entry point can be some wrapper binary which takes multiple parameter (as ENTRYPOINT
in a dockerfile might accept multiple parameters).
What is the use case for this?
There are some poorly designed services with features (such as Github Actions job services) that can take an --entrypoint
arg, but don't provide any other way to potentially specify container command or args. This would be a nice workaround, under the assumption that third parties won't fix their software.