Docker container – Run a container with access to the host’s docker daemon and volumes


docker run --rm -it -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/docker/volumes:/var/lib/docker/volumes --mount source=myvol1,target=/vol alpine sh

 

The above command runs a container (alpine image). Inside this container, you have access to the docker daemon of the host as well as the volumes.

Meaning that, from that container, you can manage containers (start, stop, inspect, …)

You can also start new containers with volumes.


apk update && apk add docker

docker run --rm -it --mount source=myvol1,target=/vol alpine sh

 

Advertisements

Netdata in Docker – Monitor my machine

Netdata: https://github.com/netdata/netdata & https://www.netdata.cloud/

is a wonderful tool to monitor a device and trigger alarms

To run it in a second on your local machine, use this docker command

docker run -d --name=netdata -p 19999:19999 -v /proc:/host/proc:ro -v /sys:/host/sys:ro -v /var/run/docker.sock:/var/run/docker.sock:ro --rm --cap-add SYS_PTRACE --security-opt apparmor=unconfined netdata/netdata

Then access the dashboard http://localhost:19999

Docker – boot2docker – Create a new docker virtual machine to a specific location

Yesterday I told about moving the exisitng default boot2docker machine to my secondary hard drive.

Today, I wanted to create a new docker virtual machine directly to a specific location.

docker-machine -s "D:\softwares\Docker Toolbox\docker-vm" create --driver virtualbox machineName

Set as default location

Finally, I want to always use this new location so as mentionned here I created the variable environnement MACHINE_STORAGE_PATH with the path = D:\softwares\Docker Toolbox\docker-vm