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

Docker in docker #387

Merged
merged 1 commit into from
Apr 13, 2020
Merged

Docker in docker #387

merged 1 commit into from
Apr 13, 2020

Commits on Apr 11, 2020

  1. Add support for docker in docker

    When using docker-in-docker, for example in dev or CI containers, one
    normally gives access to the host docker environment to the docker
    container. If the container spins up another child container, and wishes
    to share a directory, one needs to compute the pass the right paths from
    view of the host system.
    
    If the environment variable CROSS_DOCKER_IN_DOCKER=true, we call `docker
    inspect $HOSTNAME`, to learn about details of the current container.
    The `Mounts` field contains information about all mounts from the host
    into the current container. The `GraphDriver` field gives us information
    about the storage driver and the location in the host system of the
    current containers root directory. Based on these information we compute
    a table of all container mounts (`source->destination`).
    
    When starting a child container we adapt all paths to be mounted having
    a prefix in the table, to start with source. For example when mounting a
    dev containers `/usr/local/cargo` directory, we will actually mount
    `/var/lib/docker/overlay2/<parent container id>/merged/usr/local/cargo`.
    
    If the project itself is mounted into the parent container, we will not
    use the overlay directory, but find the project path on the host.
    
    In order to access the parent containers rust setup, the child container
    mounts the parents overlayfs. The parent must not be stopped before the
    child container, as the overlayfs can not be unmounted correctly by
    docker if the child container still accesses it.
    urso authored and urso committed Apr 11, 2020
    Configuration menu
    Copy the full SHA
    f2c70b3 View commit details
    Browse the repository at this point in the history