Dockerfile option Volume - where is it mounted with k3s? #5770
-
Hi friends, I have a quick question. In a Dockerfile I can add something like this: VOLUME ["$HOME/log", "$HOME/run"] If I start the container with So, are those "volumes" mounted somewhere else? Hope you could follow my thoughts. If anything is written unclear, please let me know. Have a great evening, sando |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
This is more of a Kubernetes question, see the discussion here: kubernetes/kubernetes#52032 |
Beta Was this translation helpful? Give feedback.
-
Yes, the volumes are still mounted, but (as you expected) somewhere else. K3s bundles containerd as the container runtime instead of docker. You can use the command As an example, let's take a look at the official redis image which declares a volume in its Dockerfile:
Let's use
Alright. Now we take the container-id and feed it to "mounts": [
{
"destination": "/data",
"type": "bind",
"source": "/var/lib/rancher/k3s/agent/containerd/io.containerd.grpc.v1.cri/containers/e029be12bf574fb3c8ae226a50e5428a0f68cebfe8c18da9af9a840d7706bf99/volumes/cabd5615b60c408b24700549002ad0b9b609c529481e955a9143919c8d7bc56a",
"options": [
"rbind",
"rprivate",
"rw"
]
}, There you go. It looks like containerd creates the volumes at |
Beta Was this translation helpful? Give feedback.
-
Thanks a lot to you both! This morning I also thought, well, actually a containerd related question.. Nevertheless, thanks! |
Beta Was this translation helpful? Give feedback.
Yes, the volumes are still mounted, but (as you expected) somewhere else.
K3s bundles containerd as the container runtime instead of docker. You can use the command
k3s ctr
as a CLI for containerd.As an example, let's take a look at the official redis image which declares a volume in its Dockerfile:
Let's use
k3s ctr container list
(which is roughly equivalent todocker ps
) to find the container-id. Keep in mind that you have to run this command on the node where the container is actually running. For me it looks like this: