Saturday 9 May 2020

Docker: Run the bash shell in interactive mode

Below command pulls python image if not exist and runs the bash shell in interactive mode.

docker run -it --rm python:3 /bin/bash

-it: Run the container in interactive mode.
--rm: Remove the container after its execution
/bin/bash: Command to be executed.

$docker run -it --rm python:3 /bin/bash
root@8e7afceedc1e:/#

root@8e7afceedc1e:/# pwd
/
root@8e7afceedc1e:/# ls -a
.  ..  .dockerenv  bin boot  dev  etc home  lib  lib64  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var
root@8e7afceedc1e:/#

Execute the command ‘exit’ to come out of the container.

root@8e7afceedc1e:/# exit
exit
$


Previous                                                    Next                                                    Home

No comments:

Post a Comment