Skip to content

Commit 926a3db

Browse files
Add instructions on using snapshotter with docker and nerdctl (#243)
* update snapshotter instructions (#232) * Add instructions on using snapshotter with docker Signed-off-by: Amal Thundiyil <[email protected]> --------- Signed-off-by: Amal Thundiyil <[email protected]> Co-authored-by: Valentin Volkl <[email protected]>
1 parent bb0ef49 commit 926a3db

File tree

1 file changed

+70
-5
lines changed

1 file changed

+70
-5
lines changed

cpt-containers.rst

Lines changed: 70 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ directory when containers using it are stopped.
219219
How to use the CernVM-FS Snapshotter
220220
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
221221

222-
The CernVM-FS snapshotter runs alongside the containerd service.
222+
The CernVM-FS snapshotter runs alongside the containerd service (compatible with v1.4.0 < containerd < v2.0) .
223223
The snapshotter communicates with ``containerd`` via gRPC over a UNIX domain socket.
224224
The default socket is ``/run/containerd-cvmfs-grpc/containerd-cvmfs-grpc.sock``.
225225
This socket is created automatically by the snapshotter if it does not exist.
@@ -242,20 +242,20 @@ A template ``config.toml`` file looks like this:
242242
243243
# /etc/containerd/config.toml
244244
245+
# important: explicitly use version 2 config format -
246+
# the plugin configuration does not work in v1!
245247
version = 2
246248
247-
# Source of image layers
248-
repository = "unpacked.cern.ch"
249-
absolute-mountpoint = "/cvmfs/unpacked.cern.ch"
250249
251250
# Ask containerd to use this particular snapshotter
252251
[plugins."io.containerd.grpc.v1.cri".containerd]
253252
snapshotter = "cvmfs-snapshotter"
253+
# important: the cvmfs snapshotter needs annotations to work.
254254
disable_snapshot_annotations = false
255255
256256
# Set the communication endpoint between containerd and the snapshotter
257257
[proxy_plugins]
258-
[proxy_plugins.cvmfs]
258+
[proxy_plugins.cvmfs-snapshotter]
259259
type = "snapshot"
260260
address = "/run/containerd-cvmfs-grpc/containerd-cvmfs-grpc.sock"
261261
@@ -272,6 +272,71 @@ A template ``config.toml`` file looks like this:
272272
Note that if only the repository is specified under the key value ``repository``, the mountpoint
273273
(under the key value ``absolute-mountpoint``) is by default constructed as ``/cvmfs/<repo_name>``.
274274

275+
Running with nerdctl
276+
^^^^^^^^^^^^^^^^^^^^
277+
278+
The snapshotter can be tested and used with nerdctl (> 1.7.0). Start both containerd and cvmfs-snapshotter:
279+
280+
::
281+
282+
systemctl start containerd cvmfs-snapshotter
283+
284+
and then run or pull images:
285+
286+
::
287+
288+
nerdctl pull --snapshotter cvmfs-snapshotter clelange/cms-higgs-4l-full:latest
289+
nerdctl run -it --rm --snapshotter cvmfs-snapshotter clelange/cms-higgs-4l-full:latest
290+
291+
292+
Pulling this 9GB (4.3GB compressed) image usually takes about two minutes, with the cvmfs-snapshotter, this should be reduces to a few seconds (however cvmfs will need to download files when accessed later).
293+
294+
295+
See also the `cvmfs documentation page in nerdctl. <https://github.com/containerd/nerdctl/blob/main/docs/cvmfs.md>`_.
296+
297+
Running with docker
298+
^^^^^^^^^^^^^^^^^^^
299+
300+
.. note::
301+
The containerd image store is an experimental feature of Docker Engine.
302+
303+
The snapshotter can be tested and used with docker (> 24.0).
304+
305+
1. Write the following configuration to `/etc/docker/daemon.json`
306+
307+
.. code-block:: json
308+
309+
{
310+
"storage-driver": "cvmfs-snapshotter",
311+
"features": {
312+
"containerd-snapshotter": true
313+
}
314+
}
315+
316+
317+
2. Restart the deamon
318+
319+
::
320+
321+
systemctl restart docker
322+
323+
3. Verify if you're using the containerd storage driver:
324+
325+
::
326+
327+
$ docker info -f '{{ .DriverStatus }}'
328+
[[driver-type io.containerd.snapshotter.v1]]
329+
$ docker info -f '{{ .Driver }}'
330+
cvmfs-snapshotter
331+
332+
4. Then run or pull images:
333+
334+
::
335+
336+
docker pull clelange/cms-higgs-4l-full:latest
337+
docker run -it --rm clelange/cms-higgs-4l-full:latest
338+
339+
Pulling this image should be done in few seconds with the snapshotter. See also the `containerd image store manual page in docker. <https://docs.docker.com/engine/storage/containerd/>`_.
275340

276341
Running with k3s
277342
^^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)