Search code examples
docker

Docker command difference


I am new to docker container. Can someone please tell me what is difference between these two commands. In my knowledge, have the same out put than why we use the bash command.

docker run -it ubuntu 
docker run -it ubuntu bash

Solution

  • docker run -it ubuntu let's you run command inside the container.

    The bash is the command to run.

    For example instead you can run

    docker run -it ubuntu ls /home
    

    This will list the /home dir inside the container.