Docker Lab Day 2

What is docker update ?

We can change the configurations of an already running container which is observed by the docker server for > 10 seconds in the following test which we are going to run using the restart policy.

 docker update --restart always test-update

Then went inside the container using bash and killed it using process id 1

docker exec -it test-update /bin/bash
root@a7eb846de486:/usr/local/apache2# kill 1

Although the container got terminated by itself still due to restart policy came back again

root@a7eb846de486:/usr/local/apache2# [root@ip-172-31-17-58 centos]# docker ps
CONTAINER ID   IMAGE     COMMAND                  CREATED             STATUS             PORTS                                   NAMES

a7eb846de486   httpd     "httpd-foreground"       13 minutes ago      Up 3 seconds       80/tcp                                  test-update

One more thing to note is when we did a docker stop – then it did not restart. Why? Since this restart policy does not apply to manual stops to avoid restart cycle clashes.

What is docker wait ?

It waits even though we run in detached mode till 1/more container is stopped with exit code 0 – i.e. graceful exit

Till the time we had not put a command like –

docker stop  06ead66c7817d59c371a436350fe0f574823214609c608eda3632258fae6da4e

Post which we saw it exited as in line no. 2

[root@ip-172-31-17-58 centos]#  docker run -itd ubuntu
[root@ip-172-31-17-58 centos]# docker wait 06ead66c7817d59c371a436350fe0f574823214609c608eda3632258fae6da4e