Lab de Dockerfile do curso Application Development with Red Hat OpenShift
git clone https://github.com/leomachadorocha/dockerfile-lab.git
$ chmod 755 loveLXC.sh
$ docker build --rm=true -t demorepo/lovelxc .
$ docker images
$ docker run -d --name="my-lovelxc-container" demorepo/lovelxc
$ docker logs -f my-lovelxc-container
$ docker rm -f my-lovelxc-container
$ docker run -d --name="my-lovelxc-container" -e NAME="The world" demorepo/lovelxc
$ docker logs -f my-lovelxc-container
===========================================================================================
11 - Execute the docker inspect command and retrieve the path on the host operating system to the container volume
$ docker inspect -f '{{json .Mounts}}' my-lovelxc-container | jq
[
{
"Destination": "/var/lovelxc",
"Driver": "local",
"Mode": "",
"Name": "3f249a116633074e34840ddea836f26a570b7ef36bcdb01cdbd22f8f37cf4705",
"Propagation": "",
"RW": true,
"Source": "/var/lib/docker/volumes/3f249a116633074e34840ddea836f26a570b7ef36bcdb01cdbd22f8f37cf4705/_data"
}
]
OBS:
/var/lovelxc = directory in the container ($ docker exec -it my-lovelxc-container sh)
/var/lib/docker/volumes/ = directory in the host
12 - View the contents of the file written by the script to this external volume on the host operating system
$ cat /var/lib/docker/volumes/3f249a116633074e34840ddea836f26a570b7ef36bcdb01cdbd22f8f37cf4705/_data/super_top_secret_log.log | more
The world loves linux containers
The world loves linux containers
The world loves linux containers
===========================================================================================
$ docker rm -f my-lovelxc-container
$ docker rmi demorepo/lovelxc
$ docker rmi busybox