Commit Graph

42 Commits

Author SHA1 Message Date
Avi Deitcher
198db9089f
containerd 20 (#4100)
* bump containerd-dev to 2.0.2

Signed-off-by: Avi Deitcher <avi@deitcher.net>

* update pkg/init libs to containerd-20

Signed-off-by: Avi Deitcher <avi@deitcher.net>

* bump linuxkit CLI containerd deps to 20

Signed-off-by: Avi Deitcher <avi@deitcher.net>

* update test/pkg/containerd to work with containerd v2.x tests

Signed-off-by: Avi Deitcher <avi@deitcher.net>

* update containerd-dev deps

Signed-off-by: Avi Deitcher <avi@deitcher.net>

* update pkg/init and pkg/containerd dependencies

Signed-off-by: Avi Deitcher <avi@deitcher.net>

* update test/pkg/containerd deps

Signed-off-by: Avi Deitcher <avi@deitcher.net>

---------

Signed-off-by: Avi Deitcher <avi@deitcher.net>
2025-02-24 18:40:56 +02:00
Avi Deitcher
5848a2856f use only stdout/stderr or file for runc output
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2024-08-28 14:45:26 +03:00
Avi Deitcher
15c808c4ee more verbose runc messages
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2024-08-22 20:23:44 +03:00
Avi Deitcher
b36cad081b when building read-only volumes, still use overlayfs
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2024-08-22 18:49:08 +03:00
Avi Deitcher
2af30c5503 support cmdline-driven debugging mode for runc
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2024-08-22 15:14:35 +03:00
Avi Deitcher
a5085fc9ea pkg/init support for volumes
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2024-07-21 17:48:39 +03:00
Stijn Opheide
247d919a81
remove file at fifo logging location if it exists
Signed-off-by: Stijn Opheide <stijn@opheide.be>
2023-04-18 14:28:01 +02:00
Avi Deitcher
45e299ce91
Merge pull request #3848 from dgageot/remove-more-dead-code-pkg
Remove dead or redundant code (packages)
2022-10-10 20:55:02 +03:00
David Gageot
39807bb0bd Remove dead or redundant code
Signed-off-by: David Gageot <david.gageot@docker.com>
2022-10-09 15:33:42 +02:00
David Gageot
810c3e788f
Prefer nil empty slices
Signed-off-by: David Gageot <david.gageot@docker.com>
2022-10-09 15:02:23 +02:00
David Gageot
d4e132021a
Remove 99% of deprecated ioutil usage
Signed-off-by: David Gageot <david.gageot@docker.com>
2022-10-09 13:10:38 +02:00
David Gageot
998ad7eea1
Fix comments
Signed-off-by: David Gageot <david.gageot@docker.com>
2022-10-08 22:41:20 +02:00
David Scott
c4d7f5d993 service: handle creating cgroupv2 cgroups
These are easier to create than cgroupv1 cgroups as they are only a
single mkdir.

Detect which mode we are in by looking for the presence of the
cgroupv2-only cgroup.controllers file.

Signed-off-by: David Scott <dave@recoil.org>
2022-03-13 19:37:05 +00:00
Dave Tucker
fcaab549fe init: Migrate to Go Modules
Moves vendoring over to Go modules.
Fixes issues found by Go Vet in Go 1.16

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2022-01-11 20:18:37 +00:00
Avi Deitcher
ef3e45ac02 pkgs: Update packages to the latest linuxkit/alpine
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2021-04-28 09:13:18 +03:00
Avi Deitcher
203cbd9b9f multiple containerd options
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2020-10-21 11:11:48 +03:00
Avi Deitcher
54be4048f0 fix reversed equals error
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2020-10-19 20:54:14 +03:00
Avi Deitcher
865ed8a1ce add containerd cli opts
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2020-10-19 14:49:15 +03:00
Rolf Neugebauer
2427145dfc pkg/init: Revert "workaround bad containerd bug"
This reverts commit 6653c3387e.

Signed-off-by: Rolf Neugebauer <rn@rneugeba.io>
2020-04-26 22:49:48 +01:00
Avi Deitcher
6653c3387e workaround bad containerd bug
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2020-03-23 12:18:14 +02:00
Justin Cormack
cf5cec204d
Update LinuxKit for merge of moby tool
- use the mkimage hashes that we had in LinuxKit as more up to date than tool.
- update docs
- move the code from moby under src/cmd/linuxkit

Signed-off-by: Justin Cormack <justin@specialbusservice.com>
2018-07-16 14:22:15 +01:00
David Scott
7c243a8e8b pkg/init: only create /var/log/onboot symlink if not using memlogd
When logging directly to files (the not-using-memlogd case) the onboot
services must log to /run/log because /var/log might be overmounted
by a persistent disk. Therefore we create a symlink at the end of
the onboot section.

When logging via memlogd, all logs are buffered until a logwrite service
starts, so no symlink is needed.

Signed-off-by: David Scott <dave.scott@docker.com>
2018-07-13 11:47:43 +01:00
David Scott
5201049f2c pkg/init: write stderr to <name> rather than <name>.err
This will then be written to disk as <name>.log by logwrite.

Part of #3111

Signed-off-by: David Scott <dave.scott@docker.com>
2018-07-13 10:48:31 +01:00
David Scott
f4bbce7a6c service: use the logging system with runc
If external logging is enabled, this patch sets the stdout and stderr
of the `runc` invocations to one end of a socketpair and the other end is
sent to the logging service. Otherwise we log to files as before.

Signed-off-by: David Scott <dave.scott@docker.com>
2018-07-06 21:49:21 +01:00
David Scott
4dc75bc67b service: use the logging system with containerd
An external logging system exists if the socket

  /var/run/linuxkit-external-logging.sock

exists.

If an external logging system is enabled then create FIFOs for
containerd and send the other end of the FIFOs to the logging service.
Otherwise use /var/log files as before.

Signed-off-by: David Scott <dave.scott@docker.com>
2018-07-06 21:48:57 +01:00
Justin Barrick
9821180548 Add a restart and stop command to service.
Signed-off-by: justinbarrick <jbarrick@cloudflare.com>
2018-06-12 15:04:16 -07:00
Ian Campbell
e8e28c27e9 Bump packages to new alpine w/ containerd v1.1.0-rc.2
Since we are building containerd v1.1.0 with go 1.10 (as it requires) to the
same for init and runc too for consistency. In the case of init it is actually
required since we use the containerd client library there.

The subreaper interfaces have been removed from containerd and replaced with a
similar interface in runc/libcontainer, update init to use that now.

Signed-off-by: Ian Campbell <ijc@docker.com>
2018-04-18 11:27:03 +01:00
Avi Deitcher
cc57288b64 Add logging to /var/log for onboot containers
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2018-03-02 15:29:23 +02:00
Justin Cormack
4b9ffadb2e Add support for runtime containerd namespace configuration
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2018-01-18 12:40:56 +00:00
Ian Campbell
794ea7ed72 Make runtime.mounts[].destination relative to container rootfs
This is similar to ae64ab6b82 from #2849 which
did the same for runtime.mkdir.

This makes it possible to specify both host (absolute) or container (relative)
paths.

Signed-off-by: Ian Campbell <ijc@docker.com>
2018-01-11 12:58:09 +00:00
Justin Cormack
ae64ab6b82 Make relative paths in runtime mkdir be relative to container rootfs
Currently all paths were treated as absolute paths.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2018-01-10 14:58:49 +00:00
Justin Cormack
a4a332f39a Use logrus not log for logging consistently
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2018-01-10 14:28:50 +00:00
Stephen J Day
fbbab9eafd
pkg/init/cmd/service: plumb containerd namespace
This PR correctly plumbs a single context to propagate the containerd
namespace to the necessary commands. Services launched with containerd
after this change will now be in a default namespace of
`services.linuxkit`.

A top-level flag is added to the service command,
`--containerd-namespace` which can be used to change, if needed.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2018-01-05 14:45:19 -08:00
Ian Campbell
28e22e40bb Bump packages to new alpine w/ containerd v1.0.0-rc.0
Minor updates due to renamings in containerd.

Signed-off-by: Ian Campbell <ijc@docker.com>
2017-12-01 13:36:16 +00:00
Justin Cormack
6cb919b489 Add support for creating cgroups in runtime section
Implements https://github.com/moby/tool/pull/181

Design for things like Kubernetes setup that requires some cgroups to
exist when the service starts but it is not running in these, other
services are, so there would be a race if they are not created in each.

Essentially it is just a sugared `mkdir` in all the cgroup dirs.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-11-17 14:12:41 +00:00
David Scott
9c35dbaac2 service: log stdout and stderr to separate files
Previously we would pass the path `/var/log/service.log` for both
stdout and stderr to containerd. containerd would construct a dict
with the paths as keys[1] and, due to the duplicate key, would only
open one of the files and start one `io.Copy` instance. Writes to
the other stream would be buffered by the pipe connected to
containerd-shim and would eventually block.

If we modified containerd to open the file twice and start 2
`io.Copy` instances, we would end up with the two streams interleaved
together. It seems cleaner to keep the streams separate; therefore
this patch logs stdout to `/var/log/service.out.log` and stderr to
`/var/log/service.err.log`.

[1]
49437711c3/linux/shim/io.go (L51)

Signed-off-by: David Scott <dave.scott@docker.com>
2017-09-14 11:15:04 +01:00
Ian Campbell
b0b08e18a2 Bump init and containerd packages to v1.0.0-alpha6
Signed-off-by: Ian Campbell <ijc@docker.com>
2017-08-29 01:02:20 +01:00
Justin Cormack
5773dfd844 Cleanup cleanup code
Only remove main mount at rootfs, as we do not really know
about the state of the rest.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-08-23 16:40:03 +01:00
Justin Cormack
49cf74f4f6 Switch to having the moby tool specify how to do mounts
This removes all the code that had knowledge of how to do read only
and read write container mounts, and just uses the runtime config.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-08-23 16:40:03 +01:00
Justin Cormack
c677b391fc Add support for mount in runtime config
This could be used in LinuxKit now, as there are some examples, eg
https://github.com/linuxkit/linuxkit/blob/master/blueprints/docker-for-mac/base.yml#L33
which are creating containers to do a mount.

The main reason though is to in future change the ad hoc code that generates
overlay mounts for writeable containers with a runtime config which does
the same thing; this code needs to create both tmpfs and overlay mounts.

See https://github.com/moby/tool/pull/145

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-08-23 16:40:03 +01:00
Justin Cormack
c82b2fe13e Add vendoring for netlink
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-08-17 12:10:28 +01:00
Justin Cormack
0c81ce19e8 Add a runtime config
This adds support for a runtime configuration file that can do:
- `mkdir` to make a directory at runtime, eg in `/var` or `/tmp`, to avoid workarounds
- `interface` that can create network interfaces in a container or move them
- `bindNS` that can bind mount namespaces of an `onboot` container to a file so a service can be started in that namespace.

It merges the `service` and `onboot` tools (in `init`) to avoid duplication. This also saves some size for
eg LCOW which did not use the `onboot` code in `runc`.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-08-17 12:10:28 +01:00