Skip to main content

Overriding Default Commands

Overriding Default Commands

If you want to override a container's default command, you can do so with -command. For example, suppose the docker/whalesay image runs command /bin/bash by default:

# icm docker -command "ps -a"

CONTAINER ID  IMAGE            COMMAND      CREATED     STATUS      NAMES
17f4ece54c2f  docker/whalesay  "/bin/bash"  4 days ago  Restarting  gracie

To have the container run a different command, such as pwd, you could deploy it as follows:

# icm run -container gracie -image docker/whalesay command pwd

You can verify that the command succeeded by examining the Docker logs:

# icm docker -command "logs gracie"
/cowsay

FeedbackOpens in a new tab