Open DanielXiao opened 6 years ago
This is surprising tbh - we'd have to go way back in time to determine if this was always a problem or a change in behavior that we missed. We can easily work around for this case by specifying the CMD values via:
docker run -it --entrypoint /bin/bash postgres -c "exec /bin/bash"
however in some cases this isn't going to be viable as the entry point we want to specify will not accept throwaway arguments and the CMD values are passed as direct argv
values.
Summary
docker run --entrypoint take unexpected parameters.
Environment information
vSphere and vCenter Server version
vSphere 6.7
VIC version
1.4.3 and 1.5.0
VCH configuration
./bin/vic-machine-linux create --name=v150-photon-2 --target 10.161.93.246 --user 'administrator@vsphere.local' --password 'Admin!23' --image-store=sharedVmfs-0 --compute-resource=/dc1/host/cls/Resources --public-network=management --volume-store sharedVmfs-0/v150-photon-2:default --bridge-network bridge --bridge-network-range 192.168.0.0/16 --container-network vm-network --thumbprint 'BF:68:A6:73:B4:D3:62:A9:21:3E:B0:73:B8:A2:25:2A:31:41:86:C0' --no-tlsverify
Details
When you add --entrypoint to run a container without entrypoint instruction of its Dockerfile, CMD instruction is passed as arguments: docker -H 10.161.90.47:2376 --tls run --entrypoint=/bin/date busybox date: invalid date 'sh'
When you add --entrypoint to overwrite entrypoint instruction of the container 's Dockerfile, image name is passed as arguments: docker -H 10.161.90.159:2376 --tls run -it --entrypoint /bin/sh postgres /bin/sh: 0: Can't open postgres
Steps to reproduce
Run busybox with following command: docker -H:2376 --tls run --entrypoint=/bin/date busybox
Run postgres with following command: docker -H:2376 --tls run -it --entrypoint /bin/sh postgres
Below are results of a docker engine: docker run --entrypoint=/bin/date busybox Mon Oct 29 05:55:02 UTC 2018
docker run -it --entrypoint /bin/sh postgres Enter sh prompt.
Actual behavior
date: invalid date 'sh'
/bin/sh: 0: Can't open postgres
Expected behavior
Show date command output.
Enter sh prompt without any parameter.
Logs
Troubleshooting attempted