mviereck / x11docker

Run GUI applications and desktops in docker and podman containers. Focus on security.
MIT License
5.5k stars 370 forks source link

CMD/ENTRYPOINT behaviour inconsistent with docker #485

Closed mackworthy closed 3 months ago

mackworthy commented 1 year ago

Given the following Dockerfile:

FROM ubuntu:22.10
CMD echo "hello world"

I get the following output when running with docker directly: docker build -t testcontainer . && docker run -it --rm testcontainer

Sending build context to Docker daemon  3.072kB
Step 1/2 : FROM ubuntu:22.10
 ---> 10c2f4041af1
Step 2/2 : CMD echo "hello world"
 ---> Running in e369a1c52113
Removing intermediate container e369a1c52113
 ---> 468dba470e32
Successfully built 468dba470e32
Successfully tagged testcontainer:latest
hello world

However, running with x11docker yields an error, instead of correctly returning "hello world" as docker did: x11docker testcontainer

x11docker WARNING: User mackworthy is member of group docker.
  That allows unprivileged processes on host to gain root privileges.

x11docker note: Option --xc for X in container enabled automatically.

x11docker note: Using X server option --nxagent

x11docker note: A few applications do not work well with --nxagent.
  In that case, you can try to fix the issue with option --composite
  or try another X server option like --xpra (seamless) or --xephyr (windowed).

x11docker note: Option --network=none is set to disable network access.
  If you need network and internet access, set option -I, --network [=NET].

/x11docker/cmdrc: 91: -c: not found
/x11docker/cmdrc: 92: echo "hello world": not found
/x11docker/cmdrc: 96: /bin/sh
-c
echo: not found

An error occurs whether you use CMD or ENTRYPOINT, with Shell form or Exec form.

FROM ubuntu:22.10
CMD ["echo", "hello world"]

docker build -t testcontainer . && docker run -it --rm testcontainer

Sending build context to Docker daemon  3.072kB
Step 1/2 : FROM ubuntu:22.10
 ---> 10c2f4041af1
Step 2/2 : CMD ["echo", "hello world"]
 ---> Running in e127ad651103
Removing intermediate container e127ad651103
 ---> 93b227d84b03
Successfully built 93b227d84b03
Successfully tagged testcontainer:latest
hello world

x11docker testcontainer

x11docker WARNING: User mackworthy is member of group docker.
  That allows unprivileged processes on host to gain root privileges.

x11docker note: Option --xc for X in container enabled automatically.

x11docker note: Using X server option --nxagent

x11docker note: A few applications do not work well with --nxagent.
  In that case, you can try to fix the issue with option --composite
  or try another X server option like --xpra (seamless) or --xephyr (windowed).

x11docker note: Option --network=none is set to disable network access.
  If you need network and internet access, set option -I, --network [=NET].

/x11docker/cmdrc: 91: hello world: not found
/x11docker/cmdrc: 94: echo
hello: not found

My environment:

mviereck commented 1 year ago

Thank you for the report! I'll have a look, might take some time.