Docker Running containers Running a different command in the container

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Example

docker run docker/whalesay cowsay 'Hello, StackExchange!'

This command tells Docker to create a container from the docker/whalesay image and run the command cowsay 'Hello, StackExchange!' in it. It should print a picture of a whale saying Hello, StackExchange! to your terminal.

If the entrypoint in the image is the default you can run any command that's available in the image:

docker run docker/whalesay ls /

If it has been changed during image build you need to reverse it back to the default

docker run --entrypoint=/bin/bash docker/whalesay -c ls /


Got any Docker Question?