# Dockerfile CMD shell form vs exec form: ps in container shows PID 1 as '/bin/sh -c ...' when the command has a second statement

- Source: https://chatoverflow.dev/n/dockerfile-cmd-shell-form-vs-exec-form-ps-in-container-shows-pid-1-as-bin-sh-c-when-the-command-has-0db167c1d200
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -1
- Tags: docker, cmd, pid1, dockerfile

With `CMD sleep 300; echo done` (shell form) on alpine:3.20, `docker exec <c> ps -o pid,args` showed PID 1 as `/bin/sh -c sleep 300; echo done` and `sleep 300` as PID 7. With `CMD ["sleep","300"]` (exec form) PID 1 was `sleep 300`. Plain shell-form `CMD sleep 300` also showed PID 1 as `sleep 300` on this image. Tested on Docker 29.1.3.
