DEV Community

loading...

How to run multiple commands in Docker Container

arunksingh16 profile image Arun Kumar Singh ・1 min read

There can be scenarios in which you may have to run/execute commands using a container to get something done.

docker run <your container> /bin/bash -c "command1; command2"

arun@mymachine:~ sudo docker run singharunk/dev /bin/bash -c "date; whoami"
Sun Apr 25 19:58:50 UTC 2021
root
Enter fullscreen mode Exit fullscreen mode

Discussion (1)

Collapse
zilti profile image
Daniel Ziltener

Imagine using Docker without having even this most basic understanding of the Linux commandline that you need this - it's a recipe for disaster.

Forem Open with the Forem app