docker for dummies




Install Mongo:
 docker run -d -p 27017:27017 -d --name mongo mongo  
 docker run -d -p 27017:27017 -d --name dbNoSQL mongo:4
  
 $ docker run hello-world (run the hello-world container)
  
 $ docker ps (shows active containers)
  
 $ docker ps -a (shows all containers)
  
 $ docker inspect (container ID)(shows detailed information about a container)
  
 $ docker inspect (name)  (same as above but invoked with the name)
  
 $ docker run --name hello-vass hello-world (assigns a custom name "hello-paul")
  
 $ docker rename hello-vass hola-pablo bass (changed the name from hello-paul to hola-platzi)
  
 $ docker rm (ID or name) (deletes a container)
  
 $ docker container prune (deletes all stopped containers)
  
 $ docker run ubuntu (runs an ubuntu but leaves it off)
  
 $ docker ps -a (lists all containers)
  
 $ docker -it ubuntu (runs it and enters the ubuntu shell)
  
 -i: interactive
  
 -t: opens the console
  
 cat /etc/lsb-release (see the Linux version)
  
 $ docker ps -a (see all containers)
  
$ docker --name (name) -d ubuntu -f (command)
  
$ docker --name alwaysup -d ubuntu tail -f /dev/null (keeps the container active)
  
$ docker exec -it alwaysup bash (enters the container)
  
$ docker inspect --format ‘{{.State.Pid}}’ alwaysup (sees the main process of ubuntu)
  
$ docker inspect --format ‘{{.State.Pid}}’ alwaysup (sees the main process of ubuntu)
  
from Linux if I run kill -9 it kills the process inside the ubuntu container but it doesn't work from MAC
$ docker ps -a (see all containers)
  
$ docker --name (name) -d ubuntu -f (command)
  
$ docker --name alwaysup -d ubuntu tail -f /dev/null (keeps the container active)
  
$ docker exec -it alwaysup bash (enters the container)
  
$ docker inspect --format ‘{{.State.Pid}}’ alwaysup (sees the main process of ubuntu)
  
from Linux if I run kill -9 it kills the process inside the ubuntu container but it doesn't work from MAC
docker run -p 61616:61616 -p 8161:8161 -d --name amq rmohr/activemq
  
all of the autage is the acceptance is within the autage

Comments

Post a Comment