Skip to content

GitLab Next

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
gitlab-runner
gitlab-runner
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 2,034
    • Issues 2,034
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 198
    • Merge Requests 198
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GitLab.org
  • gitlab-runnergitlab-runner
  • Merge Requests
  • !1674

Closed
Opened Nov 19, 2019 by Arran Walker@fiveturns0 of 3 tasks completed0/3 tasks
  • Report abuse
Report abuse

Add docker sandbox container support (network isolation)

  • Overview 28
  • Commits 2
  • Pipelines 8
  • Changes 5

👋 Closed this merge request because of !1674 (comment 269674747) 👋

What does this MR do?

Adds sandbox container support, similar to how Kubernetes creates Pods, initially focusing on network isolation.

For each build, before services, a parent container is created. This container is referred to as the sandbox container. Docker allows you to then join additional containers (services, build) into the sandbox's network, IPC and Pid namespaces.

This MR focuses solely on joining containers to the sandbox's network namespace. In the future, I think we should also allow IPC and Pid namespace sharing to be user controlled.

The global configured Docker.NetworkMode, Docker.ExtraHosts and Docker.Links can still be used and are compatible, even with the sandbox container enabled. However, these settings are only applied to the sandbox container, rather than all containers. The behaviour is as you'd expect: containers sharing the same network namespace inherit the ExtraHosts, can access any linked containers and share the configured network mode.

Why was this MR needed?

  • There is a clear need for network isolation and to escape Docker's legacy linking. One such MR already plans to add this using a network manager and bringing up a network for each build (!1569 (merged)). The end-user experience of the two is that ultimately the sandbox container support mimics Kubernetes' behaviour. All containers are available to localhost, as opposed to each being given a different IP address. This does have the benefit that moving between the two executors should be less painful.

    This MR doesn't have to be a replacement for !1569 (merged). If there is a requirement for network isolation through bringing up a new network for whatever reason, both solutions should work even when both enabled. If both enabled, the sandbox container would be assigned the new network, and the child containers would still share that network's namespace.

  • In the future, we can use the sandbox container to support IPC namespace sharing.

  • In the future, we can use the sandbox container to support Pid namespace sharing, and some of the bonuses that go along with that, such as zombie process cleanup.

Are there points in the code the reviewer needs to double check?

  • There's a test for creating the sandbox container, and checking that child containers are then using it, but nothing that explicitly does a working e2e test with Docker and the sandbox container enabled. Unless there's already e2e tests that are executing and modifying the feature flags, this might be good to add? But I'm not sure if anything else does that.

Does this MR meet the acceptance criteria?

  • Documentation created/updated
  • Added tests for this feature/bug
  • In case of conflicts with master - branch was rebased

What are the relevant issue numbers?

!1569 (merged) #1042 (closed) #4430 (closed)

Edited Jan 10, 2020 by Steve Azzopardi
Assignee
Assign to
Reviewer
Request review from
12.8
Milestone
12.8 (Past due)
Assign milestone
Time tracking
Reference: gitlab-org/gitlab-runner!1674
Source branch: docker-sandbox