opencontainers / opencontainers/runc

How to create a container with the same root fs as the host?

Open
#1,909 13 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
13.5k
Forks
2.3k
Avg merge
2d 8h
Merged PRs (30d)
30

Description

Hello,

I'm trying to create a container that runs in its own namespaces (mount, net, uts, etc.). But the special thing I want to achieve is that it has the same view on the filesystem as the root, unless it tries to modify its own VFS.

For that I try to specify path to rootfs as "/", but the creation of the container does not work this way and fails with "invalid argument":

sudo ./test-runc hostname
2018/10/13 10:34:34 exec: "hostname": executable file not found in $PATH
2018/10/13 12:34:34 Failed to launch the container: container_linux.go:336: starting container process caused "exec: "hostname": executable file not found in $PATH"

Here is the full example I tried to run: test-runc

I still want to run the container in a separate mount namespace. For example, to be able to remount /proc, but I still want the rest of the host VFS be visible from the inside of the container.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the linked test-runc example and the runc behavior around a rootfs path of "/", then run the shown hostname command to reproduce the failure. Done would mean a container can use separate namespaces while retaining the host filesystem view and still support remounting /proc, as described.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, linux
Domain
cli, operating-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.