Git Product home page Git Product logo

ubuntu-dind's Introduction

Ubuntu DinD(Docker in Docker) Image

A docker image based in ubuntu to run docker containers inside docker containers with some extras:

  1. Easy to use (More Info):

⚠️⚠️ WARNING ⚠️⚠️

The option --privileged is not secure. Just for dev or testing purposes. To do this in the GOOD AND SECURE WAY just use: https://github.com/nestybox/sysbox

docker run -it --privileged cruizba/ubuntu-dind

or with sysbox:

docker run -it --runtime=sysbox-runc cruizba/ubuntu-dind
  1. Compatible with current LTS versions of Ubuntu (focal, jammy and noble)
  2. Support for arm64 and amd64 architectures.
  3. Easy to extend, customize and use.
  4. Always updated with current buildx, compose and docker versions.

Table of Contents

  1. Credits
  2. Understanding DinD and Its Challenges
  3. Usage Guide
  4. Use Cases
  5. Available Images

1. Credits

This project was inspired by two existing repositories:

  1. DinD by alekslitvinenk: This repository served as the foundational idea, offering a lightweight solution. The distinguishing feature of my project is the use of Ubuntu as the base OS for the container and some improvements I made with time.
  2. Docker: This repository literally offers a Docker image of Docker.

2. Understanding DinD and Its Challenges

On occasion, there is a need to operate Docker containers within other Docker containers often requiring workaround solutions, especially for usage in CI/CD pipelines or software demanding extensive virtualization.

There are two methods to execute DinD:

2.1. Docker-out-of-Docker (DooD) Using Socket Sharing: Challenges

This strategy shares the socket from the host system located at /var/run/docker.sock utilizing -v /var/run/docker.sock:/var/run/docker.sock. Essentially, this technique allows us to spawn containers from the primary container, which is managed by the host system. However, any containers created within these secondary containers actually materialize only on the host system, not within the originating container itself. Two primary challenges often arise with this approach:

  • Networking Challenges: With the DooD system, when a container is instantiated within another container, the host system manages both containers. Thus, if we run a container from the DooD container which exposes port 3306, for example, this port would be visible to the host but won't be accessible by the container that initiated it.

  • Directory Volumes: Suppose we plan to operate 'container-1' within 'container-2' and attempt to share a directory from 'container-1' to 'container-2' using volumes. In that case, this won't work. The reason lies in socket sharing - we're actually not sharing directories from the primary container; instead, we're sharing directories from the host machine. Although there are solutions to these challenges, they often tend to be complex and convoluted.

2.2. DinD with Docker Daemon Running in the Container: Solution

This method, although less secure (the --privileged option bypasses numerous containerization security features), enables the creation of a fresh container with Docker inside whenever required, effectively resolving network and volumes problems. You can now share folders from 'container-1' to 'container-2', created by 'container-1', and expose ports from 'container-2', accessible from 'container-1'.

But there are actually ways to run this container securely. You can use nestybox/sysbox runtime to run this container securely. This runtime is a container runtime that enables Docker-in-Docker (DinD) with enhanced security and performance. It's a great alternative to the --privileged option.

You can see how to run this insecurely or securely in the Usage Guide section.

3. Usage Guide

Test or use this image is quite simple, and you have two options to do it.

3.1. (Insecure) Using the --privileged Option:

To use this Docker-in-Docker image, run the following command:

docker run -it --privileged cruizba/ubuntu-dind

This launches a bash terminal with an independent Docker environment isolated from your host, where you can build, run, and push Docker images.

It's not ready for production usage, but I find it useful for development and testing purposes.

3.2. (Secure) Using the nestybox/sysbox Runtime:

For this option you need to have Sysbox installed in your system. You can see how to install it here (Package installation works only in debian-based distros sadly).

To use this Docker-in-Docker image securely, run the following command:

docker run -it --runtime=sysbox-runc cruizba/ubuntu-dind

4. Use cases

4.1. Environment to Test Docker Images

Simply running the image will give you a clean environment to test your Docker images.

  • Insecure command:
docker run -it --privileged cruizba/ubuntu-dind
  • Secure command:
docker run -it --runtime=sysbox-runc cruizba/ubuntu-dind

This will run a root bash terminal inside the container, where you can run docker commands.

4.2. Running Docker Commands Directly

You can run commands directly to test images:

  • Insecure command:
docker run -it --privileged cruizba/ubuntu-dind docker run hello-world
  • Secure command:
docker run -it --runtime=sysbox-runc cruizba/ubuntu-dind docker run hello-world

4.3. Extensibility (Automating Builds, Tests with Scripts)

You can extend this image to add your own tools and configurations. I will create an example where I use this image to build this project and test it, to show you how to extend it and how powerful it can be.

FROM cruizba/ubuntu-dind:latest

# Install dependencies
RUN apt-get update && apt-get install git -y

COPY entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/entrypoint.sh

entrypoint.sh:

#!/bin/bash

# Start docker
start-docker.sh

# Your commands go here
git clone https://github.com/cruizba/ubuntu-dind
cd ubuntu-dind || exit 1
docker build . -f ubuntu-jammy.Dockerfile -t ubuntu-dind-test

docker run --privileged ubuntu-dind-test docker run hello-world

This script will clone this repository, build the image and run a container from it.

It is very important to notice that you need to run the start-docker.sh script before using docker commands. This script will start the docker daemon inside the container.

You have this example in the examples folder.

5. Available images

You can find the available images in the Docker Hub. Check also the Releases section to see the available tags: Releases

ubuntu-dind's People

Contributors

cruizba avatar dependabot[bot] avatar gabrielcossette avatar logikfabrik avatar nunofgs avatar rhelmot avatar secureflag-aedan avatar svanharmelen avatar vladfi1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ubuntu-dind's Issues

Fonts and Terminal

Hi. Thank you very much for your work.

I am wondering if you could help me out. My workflow is:

  1. I SSH into my VPS
  2. From my VPS I run docker container exec --interactive --tty <ubuntu-didn-container-id> /bin/bash
  3. Once I am in my dind container, I attach tmux tmux attach
  4. I open my LazyVim editor

Unfortunately, the icons are not rendering properly. This is what it looks like when I follow the workflow above:

image

It should look like this:

image

I am wondering what I need to do to fix this issue.

apt install fails when using ubuntu-dind as base image

FROM cruizba/ubuntu-dind

RUN apt update && apt install -y bash curl sudo

produces the following error when building:

0.037                                                                                                                                                 
0.037 WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
0.037 
1.342 Hit:1 http://ports.ubuntu.com/ubuntu-ports jammy InRelease
1.397 Err:1 http://ports.ubuntu.com/ubuntu-ports jammy InRelease
1.397   At least one invalid signature was encountered.
1.472 Get:2 http://ports.ubuntu.com/ubuntu-ports jammy-updates InRelease [119 kB]
2.018 Err:2 http://ports.ubuntu.com/ubuntu-ports jammy-updates InRelease
2.018   At least one invalid signature was encountered.
2.096 Get:3 http://ports.ubuntu.com/ubuntu-ports jammy-backports InRelease [109 kB]
2.250 Err:3 http://ports.ubuntu.com/ubuntu-ports jammy-backports InRelease
2.250   At least one invalid signature was encountered.
2.339 Get:4 http://ports.ubuntu.com/ubuntu-ports jammy-security InRelease [110 kB]
2.476 Err:4 http://ports.ubuntu.com/ubuntu-ports jammy-security InRelease
2.476   At least one invalid signature was encountered.
2.478 Fetched 338 kB in 2s (140 kB/s)
2.478 Reading package lists...
2.843 Building dependency tree...
2.915 Reading state information...
2.922 2 packages can be upgraded. Run 'apt list --upgradable' to see them.
2.922 W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://ports.ubuntu.com/ubuntu-ports jammy InRelease: At least one invalid signature was encountered.
2.922 W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://ports.ubuntu.com/ubuntu-ports jammy-updates InRelease: At least one invalid signature was encountered.
2.922 W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://ports.ubuntu.com/ubuntu-ports jammy-backports InRelease: At least one invalid signature was encountered.
2.922 W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://ports.ubuntu.com/ubuntu-ports jammy-security InRelease: At least one invalid signature was encountered.
2.922 W: Failed to fetch http://ports.ubuntu.com/ubuntu-ports/dists/jammy/InRelease  At least one invalid signature was encountered.
2.922 W: Failed to fetch http://ports.ubuntu.com/ubuntu-ports/dists/jammy-updates/InRelease  At least one invalid signature was encountered.
2.922 W: Failed to fetch http://ports.ubuntu.com/ubuntu-ports/dists/jammy-backports/InRelease  At least one invalid signature was encountered.
2.922 W: Failed to fetch http://ports.ubuntu.com/ubuntu-ports/dists/jammy-security/InRelease  At least one invalid signature was encountered.
2.922 W: Some index files failed to download. They have been ignored, or old ones used instead.
2.925 
2.925 WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
2.925 
2.942 Reading package lists...
3.268 Building dependency tree...
3.342 Reading state information...
3.420 bash is already the newest version (5.1-6ubuntu1).
3.420 curl is already the newest version (7.81.0-1ubuntu1.13).
3.420 The following NEW packages will be installed:
3.420   sudo
3.425 E: You don't have enough free space in /var/cache/apt/archives/.
3.425 0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded.
3.425 Need to get 807 kB of archives.
3.425 After this operation, 2392 kB of additional disk space will be used.
------
failed to solve: process "/bin/sh -c apt update     && apt install -y bash curl sudo" did not complete successfully: exit code: 100

POD is restarting continuously to connect dockerd

I am trying to use this image in AKS POD to connect GitHub self-hosted agent. But POD is restarting continuously. After >50 restarts Dockerd connects successfully.

POD Logs:

[Thu Jan  6 06:25:26 UTC 2022] [INFO] [/usr/local/bin/startup.sh] Waited 27 seconds of 30 seconds
[Thu Jan  6 06:25:27 UTC 2022] [INFO] [/usr/local/bin/startup.sh] Process dockerd is not running yet. Retrying in 1 seconds
[Thu Jan  6 06:25:27 UTC 2022] [INFO] [/usr/local/bin/startup.sh] Waited 28 seconds of 30 seconds
[Thu Jan  6 06:25:28 UTC 2022] [INFO] [/usr/local/bin/startup.sh] Process dockerd is not running yet. Retrying in 1 seconds
[Thu Jan  6 06:25:28 UTC 2022] [INFO] [/usr/local/bin/startup.sh] Waited 29 seconds of 30 seconds
[Thu Jan  6 06:25:29 UTC 2022] [ERROR]  dockerd is not running after max time

Can you please help us on this?

CVEs are found on trivy scan

Below are the CVEs found on the ubuntu20.04 dind image:

quay.io/arubadevops/ubuntuci:ubuntu-dind (ubuntu 20.04)

Total: 0 (UNKNOWN: 0, LOW: 0, MEDIUM: 0, HIGH: 0, CRITICAL: 0)

usr/local/bin/docker-compose (gobinary)

Total: 6 (UNKNOWN: 0, LOW: 0, MEDIUM: 2, HIGH: 4, CRITICAL: 0)

┌──────────────────────────────────────────────────────────────┬─────────────────────┬──────────┬──────────────────────┬───────────────┬──────────────────────────────────────────────────────────────┐
│ Library │ Vulnerability │ Severity │ Installed Version │ Fixed Version │ Title │
├──────────────────────────────────────────────────────────────┼─────────────────────┼──────────┼──────────────────────┼───────────────┼──────────────────────────────────────────────────────────────┤
│ github.com/docker/docker │ GHSA-jq35-85cj-fj4p │ MEDIUM │ v24.0.6+incompatible │ 24.0.7 │ /sys/devices/virtual/powercap accessible by default to │
│ │ │ │ │ │ containers │
│ │ │ │ │ │ GHSA-jq35-85cj-fj4p
├──────────────────────────────────────────────────────────────┼─────────────────────┼──────────┼──────────────────────┼───────────────┼──────────────────────────────────────────────────────────────┤
│ go.opentelemetry.io/contrib/instrumentation/google.golang.o- │ CVE-2023-47108 │ HIGH │ v0.40.0 │ 0.46.0 │ opentelemetry-go-contrib: DoS vulnerability in otelgrpc due │
│ rg/grpc/otelgrpc │ │ │ │ │ to unbound cardinality metrics │
│ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2023-47108
├──────────────────────────────────────────────────────────────┼─────────────────────┤ │ ├───────────────┼──────────────────────────────────────────────────────────────┤
│ go.opentelemetry.io/contrib/instrumentation/net/http/httptr- │ CVE-2023-45142 │ │ │ 0.44.0 │ opentelemetry: DoS vulnerability in otelhttp │
│ ace/otelhttptrace │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2023-45142
├──────────────────────────────────────────────────────────────┤ │ │ │ │ │
│ go.opentelemetry.io/contrib/instrumentation/net/http/otelht- │ │ │ │ │ │
│ tp │ │ │ │ │ │
├──────────────────────────────────────────────────────────────┼─────────────────────┤ ├──────────────────────┼───────────────┼──────────────────────────────────────────────────────────────┤
│ golang.org/x/net │ CVE-2023-39325 │ │ v0.14.0 │ 0.17.0 │ golang: net/http, x/net/http2: rapid stream resets can cause │
│ │ │ │ │ │ excessive work (CVE-2023-44487) │
│ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2023-39325
│ ├─────────────────────┼──────────┤ │ ├──────────────────────────────────────────────────────────────┤
│ │ CVE-2023-44487 │ MEDIUM │ │ │ HTTP/2: Multiple HTTP/2 enabled web servers are vulnerable │
│ │ │ │ │ │ to a DDoS attack... │
│ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2023-44487
└──────────────────────────────────────────────────────────────┴─────────────────────┴──────────┴──────────────────────┴───────────────┴──────────────────────────────────────────────────────────────┘

usr/local/bin/dockerd (gobinary)

Total: 6 (UNKNOWN: 0, LOW: 0, MEDIUM: 2, HIGH: 4, CRITICAL: 0)

┌──────────────────────────────────────────────────────────────┬─────────────────────┬──────────┬───────────────────┬────────────────────────┬──────────────────────────────────────────────────────────────┐
│ Library │ Vulnerability │ Severity │ Installed Version │ Fixed Version │ Title │
├──────────────────────────────────────────────────────────────┼─────────────────────┼──────────┼───────────────────┼────────────────────────┼──────────────────────────────────────────────────────────────┤
│ github.com/cyphar/filepath-securejoin │ GHSA-6xv5-86q9-7xr8 │ MEDIUM │ v0.2.3 │ 0.2.4 │ SecureJoin: on windows, paths outside of the rootfs could be │
│ │ │ │ │ │ inadvertently produced... │
│ │ │ │ │ │ GHSA-6xv5-86q9-7xr8
├──────────────────────────────────────────────────────────────┼─────────────────────┼──────────┼───────────────────┼────────────────────────┼──────────────────────────────────────────────────────────────┤
│ go.opentelemetry.io/contrib/instrumentation/google.golang.o- │ CVE-2023-47108 │ HIGH │ v0.29.0 │ 0.46.0 │ opentelemetry-go-contrib: DoS vulnerability in otelgrpc due │
│ rg/grpc/otelgrpc │ │ │ │ │ to unbound cardinality metrics │
│ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2023-47108
├──────────────────────────────────────────────────────────────┼─────────────────────┤ │ ├────────────────────────┼──────────────────────────────────────────────────────────────┤
│ go.opentelemetry.io/contrib/instrumentation/net/http/httptr- │ CVE-2023-45142 │ │ │ 0.44.0 │ opentelemetry: DoS vulnerability in otelhttp │
│ ace/otelhttptrace │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2023-45142
├──────────────────────────────────────────────────────────────┤ │ │ │ │ │
│ go.opentelemetry.io/contrib/instrumentation/net/http/otelht- │ │ │ │ │ │
│ tp │ │ │ │ │ │
├──────────────────────────────────────────────────────────────┼─────────────────────┤ ├───────────────────┼────────────────────────┼──────────────────────────────────────────────────────────────┤
│ google.golang.org/grpc │ GHSA-m425-mq94-257g │ │ v1.50.1 │ 1.56.3, 1.57.1, 1.58.3 │ gRPC-Go HTTP/2 Rapid Reset vulnerability │
│ │ │ │ │ │ GHSA-m425-mq94-257g
│ ├─────────────────────┼──────────┤ ├────────────────────────┼──────────────────────────────────────────────────────────────┤
│ │ CVE-2023-44487 │ MEDIUM │ │ 1.58.3, 1.57.1, 1.56.3 │ HTTP/2: Multiple HTTP/2 enabled web servers are vulnerable │
│ │ │ │ │ │ to a DDoS attack... │
│ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2023-44487
└──────────────────────────────────────────────────────────────┴─────────────────────┴──────────┴───────────────────┴────────────────────────┴──────────────────────────────────────────────────────────────┘

usr/local/lib/docker/cli-plugins/docker-buildx (gobinary)

Total: 9 (UNKNOWN: 0, LOW: 0, MEDIUM: 4, HIGH: 5, CRITICAL: 0)

┌──────────────────────────────────────────────────────────────┬─────────────────────┬──────────┬────────────────────────────────────────────────────┬────────────────────────┬──────────────────────────────────────────────────────────────┐
│ Library │ Vulnerability │ Severity │ Installed Version │ Fixed Version │ Title │
├──────────────────────────────────────────────────────────────┼─────────────────────┼──────────┼────────────────────────────────────────────────────┼────────────────────────┼──────────────────────────────────────────────────────────────┤
│ github.com/docker/docker │ GHSA-jq35-85cj-fj4p │ MEDIUM │ v24.0.5-0.20230714235725-36e9e796c6fc+incompatible │ 24.0.7 │ /sys/devices/virtual/powercap accessible by default to │
│ │ │ │ │ │ containers │
│ │ │ │ │ │ GHSA-jq35-85cj-fj4p
├──────────────────────────────────────────────────────────────┼─────────────────────┼──────────┼────────────────────────────────────────────────────┼────────────────────────┼──────────────────────────────────────────────────────────────┤
│ go.opentelemetry.io/contrib/instrumentation/google.golang.o- │ CVE-2023-47108 │ HIGH │ v0.40.0 │ 0.46.0 │ opentelemetry-go-contrib: DoS vulnerability in otelgrpc due │
│ rg/grpc/otelgrpc │ │ │ │ │ to unbound cardinality metrics │
│ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2023-47108
├──────────────────────────────────────────────────────────────┼─────────────────────┤ │ ├────────────────────────┼──────────────────────────────────────────────────────────────┤
│ go.opentelemetry.io/contrib/instrumentation/net/http/httptr- │ CVE-2023-45142 │ │ │ 0.44.0 │ opentelemetry: DoS vulnerability in otelhttp │
│ ace/otelhttptrace │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2023-45142
├──────────────────────────────────────────────────────────────┤ │ │ │ │ │
│ go.opentelemetry.io/contrib/instrumentation/net/http/otelht- │ │ │ │ │ │
│ tp │ │ │ │ │ │
├──────────────────────────────────────────────────────────────┼─────────────────────┤ ├────────────────────────────────────────────────────┼────────────────────────┼──────────────────────────────────────────────────────────────┤
│ golang.org/x/net │ CVE-2023-39325 │ │ v0.8.0 │ 0.17.0 │ golang: net/http, x/net/http2: rapid stream resets can cause │
│ │ │ │ │ │ excessive work (CVE-2023-44487) │
│ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2023-39325
│ ├─────────────────────┼──────────┤ ├────────────────────────┼──────────────────────────────────────────────────────────────┤
│ │ CVE-2023-3978 │ MEDIUM │ │ 0.13.0 │ golang.org/x/net/html: Cross site scripting │
│ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2023-3978
│ ├─────────────────────┤ │ ├────────────────────────┼──────────────────────────────────────────────────────────────┤
│ │ CVE-2023-44487 │ │ │ 0.17.0 │ HTTP/2: Multiple HTTP/2 enabled web servers are vulnerable │
│ │ │ │ │ │ to a DDoS attack... │
│ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2023-44487
├──────────────────────────────────────────────────────────────┼─────────────────────┼──────────┼────────────────────────────────────────────────────┼────────────────────────┼──────────────────────────────────────────────────────────────┤
│ google.golang.org/grpc │ GHSA-m425-mq94-257g │ HIGH │ v1.53.0 │ 1.56.3, 1.57.1, 1.58.3 │ gRPC-Go HTTP/2 Rapid Reset vulnerability │
│ │ │ │ │ │ GHSA-m425-mq94-257g
│ ├─────────────────────┼──────────┤ ├────────────────────────┼──────────────────────────────────────────────────────────────┤
│ │ CVE-2023-44487 │ MEDIUM │ │ 1.58.3, 1.57.1, 1.56.3 │ HTTP/2: Multiple HTTP/2 enabled web servers are vulnerable │
│ │ │ │ │ │ to a DDoS attack... │
│ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2023-44487
└──────────────────────────────────────────────────────────────┴─────────────────────┴──────────┴────────────────────────────────────────────────────┴────────────────────────┴──────────────────────────────────────────────────────────────┘

Update docker-compose

Hi @cruizba! We stubled upon this repo and it solved a problem we had. So thank you for making and sharing this repo!

Yet we do have one little thingy which requires us to fork the repo, and that is that we need this for arm64. This should all work fine, except that docker-compose doesn't have prebuild releases for arm64 for their 1.x versions.

So is it possible to switch to a 2.x version for compose? Or would it be possible to make it configurable? If not, we'll just keep using our fork, but I generally prefer to try and "fix" (of course it's not really broken atm) things upstream whenever possible 😊

Question: removing the /var/lib/docker volume causes issue

I tried to remove the line VOLUME /var/lib/docker in the Dockerfile, in order to persist docker state (image, build cache, etc...) inside the container but it is causing issues.

Error response from daemon: failed to create task for container: failed to start shim: mkdir /var/run/docker/containerd/daemon/io.containerd.runtime.v2.task/moby/6e1d6898d0a6bc7df4e0e1db4ed5b5014a7aea275c397997ba99c421d3570d5e: file exists: unknown

When running docker compose up inside, after a commit and restart of a container with saved docker state.

I'm using Ubuntu 22.04 both host, container and sub-containers.

Any idea of the root cause?

BTW, thanks a lot for the project, very useful to have an Ubuntu based dind!

Latest release fails to seed PRNG

Recently our pipelines began failing any jobs that used this ubuntu-dind image with the following error:

    curl: (35) Insufficient randomness

I traced this down to the update to this image...this one-liner fails with the above error:

docker run -it cruizba/ubuntu-dind:latest sh -c "apt install -y curl ; curl -fsSL https://www.ubuntu.com/"

While this works fine:

docker run -it cruizba/ubuntu-dind:jammy-26.1.3 sh -c "apt install -y curl ; curl -fsSL https://www.ubuntu.com/"

So something has clearly gone wrong with the base image for the latest release, and I imagine lots of breakages will be reported soon.

CVEs found on trivy scan

`trivy image --ignore-unfixed cruizba/ubuntu-dind
2023-09-06T22:11:53.627+0530 INFO Vulnerability scanning is enabled
2023-09-06T22:11:53.627+0530 INFO Secret scanning is enabled
2023-09-06T22:11:53.627+0530 INFO If your scanning is slow, please try '--security-checks vuln' to disable secret scanning
2023-09-06T22:11:53.627+0530 INFO Please see also https://aquasecurity.github.io/trivy/v0.36/docs/secret/scanning/#recommendation for faster secret detection
2023-09-06T22:11:53.650+0530 INFO Detected OS: ubuntu
2023-09-06T22:11:53.650+0530 INFO Detecting Ubuntu vulnerabilities...
2023-09-06T22:11:53.655+0530 INFO Number of language-specific files: 2
2023-09-06T22:11:53.655+0530 INFO Detecting gobinary vulnerabilities...

cruizba/ubuntu-dind (ubuntu 20.04)

Total: 23 (UNKNOWN: 0, LOW: 14, MEDIUM: 9, HIGH: 0, CRITICAL: 0)

┌────────────────┬────────────────┬──────────┬────────────────────┬────────────────────┬──────────────────────────────────────────────────────────────┐
│ Library │ Vulnerability │ Severity │ Installed Version │ Fixed Version │ Title │
├────────────────┼────────────────┼──────────┼────────────────────┼────────────────────┼──────────────────────────────────────────────────────────────┤
│ curl │ CVE-2023-28321 │ LOW │ 7.68.0-1ubuntu2.18 │ 7.68.0-1ubuntu2.19 │ IDN wildcard match may lead to Improper Cerificate │
│ │ │ │ │ │ Validation │
│ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2023-28321
│ ├────────────────┤ │ │ ├──────────────────────────────────────────────────────────────┤
│ │ CVE-2023-28322 │ │ │ │ more POST-after-PUT confusion │
│ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2023-28322
├────────────────┼────────────────┤ │ │ ├──────────────────────────────────────────────────────────────┤
│ libcurl4 │ CVE-2023-28321 │ │ │ │ IDN wildcard match may lead to Improper Cerificate │
│ │ │ │ │ │ Validation │
│ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2023-28321
│ ├────────────────┤ │ │ ├──────────────────────────────────────────────────────────────┤
│ │ CVE-2023-28322 │ │ │ │ more POST-after-PUT confusion │
│ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2023-28322
├────────────────┼────────────────┼──────────┼────────────────────┼────────────────────┼──────────────────────────────────────────────────────────────┤
│ libncurses6 │ CVE-2023-29491 │ MEDIUM │ 6.2-0ubuntu2 │ 6.2-0ubuntu2.1 │ Local users can trigger security-relevant memory corruption │
│ │ │ │ │ │ via malformed data │
│ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2023-29491
│ ├────────────────┼──────────┤ │ ├──────────────────────────────────────────────────────────────┤
│ │ CVE-2021-39537 │ LOW │ │ │ heap-based buffer overflow in _nc_captoinfo() in captoinfo.c │
│ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2021-39537
│ ├────────────────┤ │ │ ├──────────────────────────────────────────────────────────────┤
│ │ CVE-2022-29458 │ │ │ │ segfaulting OOB read │
│ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2022-29458
├────────────────┼────────────────┼──────────┤ │ ├──────────────────────────────────────────────────────────────┤
│ libncursesw6 │ CVE-2023-29491 │ MEDIUM │ │ │ Local users can trigger security-relevant memory corruption │
│ │ │ │ │ │ via malformed data │
│ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2023-29491
│ ├────────────────┼──────────┤ │ ├──────────────────────────────────────────────────────────────┤
│ │ CVE-2021-39537 │ LOW │ │ │ heap-based buffer overflow in _nc_captoinfo() in captoinfo.c │
│ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2021-39537
│ ├────────────────┤ │ │ ├──────────────────────────────────────────────────────────────┤
│ │ CVE-2022-29458 │ │ │ │ segfaulting OOB read │
│ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2022-29458
├────────────────┼────────────────┼──────────┤ │ ├──────────────────────────────────────────────────────────────┤
│ libtinfo6 │ CVE-2023-29491 │ MEDIUM │ │ │ Local users can trigger security-relevant memory corruption │
│ │ │ │ │ │ via malformed data │
│ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2023-29491
│ ├────────────────┼──────────┤ │ ├──────────────────────────────────────────────────────────────┤
│ │ CVE-2021-39537 │ LOW │ │ │ heap-based buffer overflow in _nc_captoinfo() in captoinfo.c │
│ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2021-39537
│ ├────────────────┤ │ │ ├──────────────────────────────────────────────────────────────┤
│ │ CVE-2022-29458 │ │ │ │ segfaulting OOB read │
│ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2022-29458
├────────────────┼────────────────┼──────────┼────────────────────┼────────────────────┼──────────────────────────────────────────────────────────────┤
│ libx11-6 │ CVE-2023-3138 │ MEDIUM │ 2:1.6.9-2ubuntu1.2 │ 2:1.6.9-2ubuntu1.5 │ InitExt.c can overwrite unintended portions of the Display │
│ │ │ │ │ │ structure if the extension... │
│ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2023-3138
├────────────────┤ │ │ │ │ │
│ libx11-data │ │ │ │ │ │
│ │ │ │ │ │ │
│ │ │ │ │ │ │
├────────────────┼────────────────┤ ├────────────────────┼────────────────────┼──────────────────────────────────────────────────────────────┤
│ ncurses-base │ CVE-2023-29491 │ │ 6.2-0ubuntu2 │ 6.2-0ubuntu2.1 │ Local users can trigger security-relevant memory corruption │
│ │ │ │ │ │ via malformed data │
│ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2023-29491
│ ├────────────────┼──────────┤ │ ├──────────────────────────────────────────────────────────────┤
│ │ CVE-2021-39537 │ LOW │ │ │ heap-based buffer overflow in _nc_captoinfo() in captoinfo.c │
│ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2021-39537
│ ├────────────────┤ │ │ ├──────────────────────────────────────────────────────────────┤
│ │ CVE-2022-29458 │ │ │ │ segfaulting OOB read │
│ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2022-29458
├────────────────┼────────────────┼──────────┤ │ ├──────────────────────────────────────────────────────────────┤
│ ncurses-bin │ CVE-2023-29491 │ MEDIUM │ │ │ Local users can trigger security-relevant memory corruption │
│ │ │ │ │ │ via malformed data │
│ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2023-29491
│ ├────────────────┼──────────┤ │ ├──────────────────────────────────────────────────────────────┤
│ │ CVE-2021-39537 │ LOW │ │ │ heap-based buffer overflow in _nc_captoinfo() in captoinfo.c │
│ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2021-39537
│ ├────────────────┤ │ │ ├──────────────────────────────────────────────────────────────┤
│ │ CVE-2022-29458 │ │ │ │ segfaulting OOB read │
│ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2022-29458
├────────────────┼────────────────┼──────────┼────────────────────┼────────────────────┼──────────────────────────────────────────────────────────────┤
│ openssh-client │ CVE-2023-38408 │ MEDIUM │ 1:8.2p1-4ubuntu0.7 │ 1:8.2p1-4ubuntu0.8 │ Remote code execution in ssh-agent PKCS#11 support │
│ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2023-38408
├────────────────┼────────────────┤ ├────────────────────┼────────────────────┼──────────────────────────────────────────────────────────────┤
│ perl-base │ CVE-2023-31484 │ │ 5.30.0-9ubuntu0.3 │ 5.30.0-9ubuntu0.4 │ CPAN.pm before 2.35 does not verify TLS certificates when │
│ │ │ │ │ │ downloading distributions over... │
│ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2023-31484
└────────────────┴────────────────┴──────────┴────────────────────┴────────────────────┴──────────────────────────────────────────────────────────────┘

usr/local/bin/docker-compose (gobinary)

Total: 1 (UNKNOWN: 0, LOW: 0, MEDIUM: 0, HIGH: 1, CRITICAL: 0)

┌────────────────────────────────┬───────────────┬──────────┬─────────────────────┬───────────────┬───────────────────────────────────────────┐
│ Library │ Vulnerability │ Severity │ Installed Version │ Fixed Version │ Title │
├────────────────────────────────┼───────────────┼──────────┼─────────────────────┼───────────────┼───────────────────────────────────────────┤
│ github.com/docker/distribution │ CVE-2023-2253 │ HIGH │ v2.8.1+incompatible │ 2.8.2-beta.1 │ DoS from malicious API request │
│ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2023-2253
└────────────────────────────────┴───────────────┴──────────┴─────────────────────┴───────────────┴───────────────────────────────────────────┘

usr/local/lib/docker/cli-plugins/docker-buildx (gobinary)

Total: 8 (UNKNOWN: 0, LOW: 1, MEDIUM: 4, HIGH: 3, CRITICAL: 0)

┌──────────────────────────────────┬────────────────┬──────────┬───────────────────────────────────────┬────────────────┬──────────────────────────────────────────────────────────────┐
│ Library │ Vulnerability │ Severity │ Installed Version │ Fixed Version │ Title │
├──────────────────────────────────┼────────────────┼──────────┼───────────────────────────────────────┼────────────────┼──────────────────────────────────────────────────────────────┤
│ github.com/containerd/containerd │ CVE-2023-25153 │ MEDIUM │ v1.6.16-0.20230124210447-1709cfe273d9 │ 1.5.18, 1.6.18 │ OCI image importer memory exhaustion │
│ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2023-25153
│ ├────────────────┤ │ │ ├──────────────────────────────────────────────────────────────┤
│ │ CVE-2023-25173 │ │ │ │ Supplementary groups are not set up properly │
│ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2023-25173
├──────────────────────────────────┼────────────────┼──────────┼───────────────────────────────────────┼────────────────┼──────────────────────────────────────────────────────────────┤
│ github.com/docker/distribution │ CVE-2023-2253 │ HIGH │ v2.8.1+incompatible │ 2.8.2-beta.1 │ DoS from malicious API request │
│ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2023-2253
├──────────────────────────────────┼────────────────┼──────────┼───────────────────────────────────────┼────────────────┼──────────────────────────────────────────────────────────────┤
│ github.com/moby/buildkit │ CVE-2023-26054 │ MEDIUM │ v0.11.2 │ 0.11.4 │ Data disclosure in provenance attestation describing a build │
│ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2023-26054
├──────────────────────────────────┼────────────────┼──────────┼───────────────────────────────────────┼────────────────┼──────────────────────────────────────────────────────────────┤
│ github.com/opencontainers/runc │ CVE-2023-27561 │ HIGH │ v1.1.3 │ 1.1.5 │ volume mount race condition (regression of CVE-2019-19921) │
│ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2023-27561
│ ├────────────────┼──────────┤ │ ├──────────────────────────────────────────────────────────────┤
│ │ CVE-2023-28642 │ MEDIUM │ │ │ AppArmor can be bypassed when /proc inside the container │
│ │ │ │ │ │ is symlinked with... │
│ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2023-28642
│ ├────────────────┼──────────┤ │ ├──────────────────────────────────────────────────────────────┤
│ │ CVE-2023-25809 │ LOW │ │ │ Rootless runc makes /sys/fs/cgroup writable │
│ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2023-25809
├──────────────────────────────────┼────────────────┼──────────┼───────────────────────────────────────┼────────────────┼──────────────────────────────────────────────────────────────┤
│ golang.org/x/net │ CVE-2022-41723 │ HIGH │ v0.4.0 │ 0.7.0 │ avoid quadratic complexity in HPACK decoding │
│ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2022-41723
└──────────────────────────────────┴────────────────┴──────────┴───────────────────────────────────────┴────────────────┴──────────────────────────────────────────────────────────────┘`

Using volumes is broken: cgroups: cgroup mountpoint does not exist: unknown.

[docker@CACTUS johannes]$ docker run -it --privileged cruizba/ubuntu-dind
[Tue Apr 13 14:21:11 UTC 2021] [INFO] [/usr/local/bin/startup.sh] Starting supervisor
[Tue Apr 13 14:21:11 UTC 2021] [INFO] [/usr/local/bin/startup.sh] Waiting for processes to be running
[Tue Apr 13 14:21:11 UTC 2021] [INFO] [/usr/local/bin/startup.sh] Process dockerd is not running yet. Retrying in 1 seconds
[Tue Apr 13 14:21:11 UTC 2021] [INFO] [/usr/local/bin/startup.sh] Waited 0 seconds of 30 seconds
[Tue Apr 13 14:21:12 UTC 2021] [INFO] [/usr/local/bin/startup.sh] Process dockerd is not running yet. Retrying in 1 seconds
[Tue Apr 13 14:21:12 UTC 2021] [INFO] [/usr/local/bin/startup.sh] Waited 1 seconds of 30 seconds
[Tue Apr 13 14:21:13 UTC 2021] [INFO] [/usr/local/bin/startup.sh] dockerd is running
root@67596c7b7c2f:/# docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
root@67596c7b7c2f:/# docker run -v /mnt:/mnt -it alpine
Unable to find image 'alpine:latest' locally
latest: Pulling from library/alpine
ca3cd42a7c95: Pull complete 
Digest: sha256:ec14c7992a97fc11425907e908340c6c3d6ff602f5f13d899e6b7027c9b4133a
Status: Downloaded newer image for alpine:latest
docker: Error response from daemon: cgroups: cgroup mountpoint does not exist: unknown.
ERRO[0004] error waiting for container: context canceled 
root@67596c7b7c2f:/# 

persistent volume

Hi, I am interested in having a persistent volume. Do you provide similar volume config as DinD?

Unable to start from repo

Hello, the cruizba/ubuntu-dind works, but when I'm trying to build the same from this repo it is not actually starting

docker build -t dind .
docker run --privileged -it --rm -v /var/run/docker.sock:/var/run/docker.sock --name dind dind

standard_init_linux.go:211: exec user process caused "no such file or directory"

The reason why I'm researching this, is because I also need dind on ubuntu but I need 18.04 version because Azure Dev Ops pipeline works with 18.04 and I want to have a docker in dockerized Azure Dev Ops agent

example gitlab-ci job

I am trying to use your image to run inside a gitlab-ci job as follows:

stages:
    - test

test_bootstrap_ubuntu-dind:
  # test the bootstrap with DIND
  stage: test
  tags:
    - docker
  image:
    name: cruizba/ubuntu-dind:latest
  services:
    - name: docker:20-dind
      alias: docker    
  before_script:
    - echo "before script"
  script:
    - echo "inside script"
    - ls -l

and get the following console messages:

[Thu Apr  1 21:09:16 UTC 2021] [INFO] [/usr/local/bin/startup.sh] Process dockerd is not running yet. Retrying in 1 seconds
[Thu Apr  1 21:09:16 UTC 2021] [INFO] [/usr/local/bin/startup.sh] Waited 29 seconds of 30 seconds
[Thu Apr  1 21:09:17 UTC 2021] [ERROR]  dockerd is not running after max time

what am doing wrong? do you have any suggestions?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.