New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nixos/tests/docker: wait for docker service #109418
Conversation
Also CC @mikroskeem who created the Docker 20.10 PR |
Previously the Docker daemon was started by systemd socket activation. Thus, the Docker test waited for the sockets.target unit. But when the docker module was changed to start the Docker daemon at boot instead of by socket activation, the test was left untouched. With the Docker 20.10 update this lead to a timing issue, where the docker command is run before the Docker daemon has started and hangs. Fixes #109416
LGTM 👍 Test passed locally (and now I know how to run them) |
I don't think this change is a solution to the real problem. We should be able to rely on socket activation, making the system more robust. The hanging behavior was probably caused by this change #108960 (review) replacing systemd's socket by docker's own socket.
|
The explanation for why #108960 broke the tests sounds plausible, but now i'm confused as to whether socket activation for the docker daemon is a thing currently, since the module has this line:
|
Socket activation for Docker is working just fine - see #108960 (review) Just for testing sake: { config, pkgs, lib, ... }:
{
systemd.services.docker.serviceConfig.ExecStart = with lib; let
cfg = config.virtualisation.docker;
in [
""
''
${cfg.package}/bin/dockerd \
--group=docker \
--host=fd:// \
--log-driver=${cfg.logDriver} \
${optionalString (cfg.storageDriver != null) "--storage-driver=${cfg.storageDriver}"} \
${optionalString cfg.liveRestore "--live-restore" } \
${optionalString cfg.enableNvidia "--add-runtime nvidia=${pkgs.nvidia-docker}/bin/nvidia-container-runtime" } \
${cfg.extraOptions}
''
];
virtualisation.docker.enable = true;
virtualisation.docker.listenOptions = ["/tmp/docker.sock" "/run/docker.sock"];
} This reverts the rogue change I introduced and passes two unix sockets to Docker daemon. You can see from the logs that:
socket activation actually works. |
Okay, then we should change the warning for |
Previously the Docker daemon was started by systemd socket activation.
Thus, the Docker test waited for the sockets.target unit.
But when the docker module was changed to start the Docker daemon at
boot instead of by socket activation, the test was left untouched.
With the Docker 20.10 update this lead to a timing issue, where the
docker command is run before the Docker daemon has started and hangs.
Fixes #109416
Motivation for this change
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)