DEV Community 👩‍💻👨‍💻

Arun Kumar Singh
Arun Kumar Singh

Posted on

How to run multiple commands in Docker Container

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

Top comments (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.

🤔 Did you know?

 
🌚 You can turn on dark mode in Settings