Howto run a process on Docker container

Howto run a process on Docker container

docker

root@ubuntu:~# docker run –rm -ti ubuntu ls
bin dev home lib64 mnt proc run srv tmp var
boot etc lib media opt root sbin sys usr
root@ubuntu:~# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d2ff7eb0b701 my-new-image2 “bash” 14 minutes ago Up 14 minutes peaceful_ptolemy
a746511c6c5c my-new-image “bash” 20 minutes ago Exited (0) 24 seconds ago pensive_leavitt
ae228703630d ubuntu “bash” 31 minutes ago Exited (0) 31 minutes ago pedantic_poitras
452b6f0f52db ubuntu:latest “bash” 2 hours ago Exited (0) 2 hours ago backstabbing_davinci
72454db1c9bf ubuntu:latest “bash” 2 hours ago Exited (0) 32 minutes ago grave_leavitt
018a507effd7 ubuntu:latest “bash” 2 hours ago Exited (0) 2 hours ago stupefied_wescoff
f2721cc01ef2 debian “bash” 2 hours ago Exited (0) 2 hours ago sick_goldstine
ce4bb924e3a2 hello-world “/hello” 2 hours ago Exited (0) 2 hours ago determined_engelbart
root@ubuntu:~# docker run –rm -ti ubuntu ls
bin dev home lib64 mnt proc run srv tmp var
boot etc lib media opt root sbin sys usr
root@ubuntu:~#

root@ubuntu:~# docker run -ti ubuntu bash -c “sleep 3; echo all done”
all done

root@ubuntu:~# docker ps -l
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
abd2a8de12fd ubuntu “bash -c ‘sleep 3; ec” 10 seconds ago Exited (0) 6 seconds ago desperate_mirzakhani
root@ubuntu:~#

Leave a reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>