Skip to content
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

Cannot use docker transport when using docker tmpfs on /tmp #387

Open
RulerOf opened this issue Dec 22, 2021 · 0 comments
Open

Cannot use docker transport when using docker tmpfs on /tmp #387

RulerOf opened this issue Dec 22, 2021 · 0 comments

Comments

@RulerOf
Copy link
Contributor

RulerOf commented Dec 22, 2021

👻 Brief Description

When using a run_option to specify /tmp as a tmpfs, using the docker transport fails. This configuration is necessary to implement the recommended way to run systemd in a container.

Version

  • kitchen-docker (2.11.0)

Environment

Mac OS with Docker Desktop 4.2.0

Scenario

The docker transport attempts to copy a shell script to /tmp inside of the container, but when it's declared as a tmpfs, this can silently fail.

Steps to Reproduce

This .kitchen.yml should do it:

---
driver:
  name: docker
  # Required by Systemd
  run_options:
    env: container=docker
    stop-signal: SIGRTMIN+3
    tmpfs:
      - /tmp
      - /run
  volume:
    - /sys/fs/cgroup:/sys/fs/cgroup:ro

transport:
  name: docker

provisioner:
  name: dummy

platforms:
  - name: oraclelinux-7

lifecycle:
  post_create:
    - remote: touch /tmp/test

suites:
  - name: default

Expected Result

The test should complete.

Actual Result

Heavily trimmed to show only relevant bits:

       Finished creating <default-oraclelinux-7> (0m1.28s).
       [Docker] Executing command on container
       /bin/bash: /tmp/docker-223dcbd9-16d7-4dab-9beb-0d414ebe7fc8.sh: No such file or directory
#<Thread:0x0000000140bc6e70 /Users/andrew.bobulsky/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/logging-2.3.0/lib/logging/diagnostic_context.rb:471 run> terminated with exception (report_on_exception is true):
/Users/andrew.bobulsky/.asdf/installs/ruby/3.0.1/lib/ruby/gems/3.0.0/gems/kitchen-docker-2.11.0/lib/kitchen/transport/docker.rb:93:in `rescue in execute': Docker failed to execute command on container. Error Details: Failed to execute command on Linux container. Failed to execute command on Docker container. Expected process to exit with [0], but received '127' (Kitchen::Transport::Docker::DockerFailed)
---- Begin output of docker -H unix:///var/run/docker.sock exec -u kitchen 2f5d7679d5a908a0f0c192bc54e489bcc1317793697538543c868b296cc29268 /bin/bash /tmp/docker-223dcbd9-16d7-4dab-9beb-0d414ebe7fc8.sh ----
STDOUT: 
STDERR: /bin/bash: /tmp/docker-223dcbd9-16d7-4dab-9beb-0d414ebe7fc8.sh: No such file or directory
---- End output of docker -H unix:///var/run/docker.sock exec -u kitchen 

➕ Additional context

I don't currently use this transport because it doesn't support kitchen login. That's a different issue that I'll probably open separately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant