From 30e7359cba9d87bbfff72b8983499e5dd86222e1 Mon Sep 17 00:00:00 2001 From: James Jones Date: Wed, 16 Nov 2022 18:09:18 -0500 Subject: [PATCH 1/4] Stubbing out very rough gitlab ci --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7fec2d1..4ac204e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -42,7 +42,7 @@ build:prereleases: - big-build script: - export IMAGE_TAG=$(echo -en $CI_COMMIT_REF_NAME | tr -c '[:alnum]_.-' '-') - - docker build --pull -t "$CI_REGISTRY_IMAGE:CI_PROJECT_NAME-$IMAGE_TAG" . + - docker build --pull -t "$CI_REGISTRY_IMAGE:$CI_PROJECT_NAME-$IMAGE_TAG" . - docker push "$CI_REGISTRY_IMAGE:$CI_PROJECT_NAME-$IMAGE_TAG" only: - branches From d33869de52973ed2b0ce39d86f9ba05fab10695b Mon Sep 17 00:00:00 2001 From: James Jones Date: Wed, 16 Nov 2022 18:49:55 -0500 Subject: [PATCH 2/4] Stubbing out very rough gitlab ci --- .gitlab-ci.yml | 17 +++++++++-------- Dockerfile | 6 +++++- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4ac204e..033d744 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -41,9 +41,9 @@ build:prereleases: tags: - big-build script: - - export IMAGE_TAG=$(echo -en $CI_COMMIT_REF_NAME | tr -c '[:alnum]_.-' '-') - - docker build --pull -t "$CI_REGISTRY_IMAGE:$CI_PROJECT_NAME-$IMAGE_TAG" . - - docker push "$CI_REGISTRY_IMAGE:$CI_PROJECT_NAME-$IMAGE_TAG" + - export IMAGE_TAG=$(echo -en $CI_COMMIT_REF_NAME | sed 's|/|-|g') + - docker build --pull -t "$CI_REGISTRY_IMAGE:$IMAGE_TAG" . + - docker push "$CI_REGISTRY_IMAGE:$IMAGE_TAG" only: - branches except: @@ -54,14 +54,15 @@ build:releases: tags: - big-build script: - - export IMAGE_TAG=$(echo -en $CI_COMMIT_REF_NAME | tr -c '[:alnum]_.-' '-') - - docker build --pull -t "$CI_REGISTRY_IMAGE:CI_PROJECT_NAME-$IMAGE_TAG" . - - docker push "$CI_REGISTRY_IMAGE:$CI_PROJECT_NAME-$IMAGE_TAG" - - docker tag "$CI_REGISTRY_IMAGE:$CI_PROJECT_NAME-$IMAGE_TAG" "$CI_REGISTRY_IMAGE:$CI_PROJECT_NAME-latest" - - docker push "$CI_REGISTRY_IMAGE:$CI_PROJECT_NAME-latest" + - docker build --pull -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_TAG" . + - docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_TAG" + - docker tag "$CI_REGISTRY_IMAGE:$CI_COMMIT_TAG" "$CI_REGISTRY_IMAGE:latest" + - docker push "$CI_REGISTRY_IMAGE:latest" only: - tags +CI_COMMIT_TAG +CI_COMMIT_BRANCH # image: fedora:latest diff --git a/Dockerfile b/Dockerfile index 2735bc8..fb04018 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,7 @@ FROM quay.io/podman/stable:latest -RUN dnf install -y podman-docker buildah skopeo \ No newline at end of file +# Adding on the docker alias, docker-compose and other useful stuff +RUN dnf install -y podman-docker buildah skopeo docker-compose + +# Remove the Emulate Docker CLI using podman messages +RUN touch /etc/containers/nodocker \ No newline at end of file From 7a4686685353f28d6a6b73925bffd7fa852d55c7 Mon Sep 17 00:00:00 2001 From: James Jones Date: Wed, 16 Nov 2022 18:50:07 -0500 Subject: [PATCH 3/4] Stubbing out very rough gitlab ci --- .gitlab-ci.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 033d744..c54f331 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -61,9 +61,6 @@ build:releases: only: - tags -CI_COMMIT_TAG -CI_COMMIT_BRANCH - # image: fedora:latest # variables: From daaa5382545853e62617af0a984bebc1ad8cb3dd Mon Sep 17 00:00:00 2001 From: James Jones Date: Wed, 16 Nov 2022 19:05:08 -0500 Subject: [PATCH 4/4] Stubbing out very rough gitlab ci --- .gitlab-ci.yml | 70 -------------------------------------------------- README.md | 20 +++++++++++++++ 2 files changed, 20 insertions(+), 70 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c54f331..d811262 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,37 +5,6 @@ before_script: - dnf install -y podman-docker - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY -# docker-build: -# # Use the official docker image. -# # image: docker:latest -# stage: build -# # services: -# # - docker:dind -# tags: -# - big-build -# before_script: -# - dnf install -y podman-docker -# - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY -# # Default branch leaves tag empty (= latest tag) -# # All other branches are tagged with the escaped branch name (commit ref slug) -# script: -# - | -# if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then -# tag="" -# echo "Running on default branch '$CI_DEFAULT_BRANCH': tag = 'latest'" -# else -# tag=":$CI_COMMIT_REF_SLUG" -# echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag" -# fi -# - docker build --pull -t "$CI_REGISTRY_IMAGE${tag}" . -# - docker push "$CI_REGISTRY_IMAGE${tag}" -# # Run this job in a branch where a Dockerfile exists -# rules: -# - if: $CI_COMMIT_BRANCH -# exists: -# - Dockerfile - - build:prereleases: stage: dind-build tags: @@ -61,42 +30,3 @@ build:releases: only: - tags -# image: fedora:latest - -# variables: -# SOMETHING: else - -# stages: -# - build -# # - deploy - -# services: -# - docker:dind - -# before_script: -# - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY - -# build:prereleases: -# stage: build -# script: -# - export IMAGE_TAG=$(echo -en $CI_COMMIT_REF_NAME | tr -c '[:alnum]_.-' '-') -# - docker build --pull -t "$CI_REGISTRY_IMAGE:CI_PROJECT_NAME-$IMAGE_TAG" . -# - docker push "$CI_REGISTRY_IMAGE:$CI_PROJECT_NAME-$IMAGE_TAG" -# only: -# - branches -# except: -# - main - -# build:releases: -# stage: build -# script: -# - export IMAGE_TAG=$(echo -en $CI_COMMIT_REF_NAME | tr -c '[:alnum]_.-' '-') -# - docker build --pull -t "$CI_REGISTRY_IMAGE:CI_PROJECT_NAME-$IMAGE_TAG" . -# - docker push "$CI_REGISTRY_IMAGE:$CI_PROJECT_NAME-$IMAGE_TAG" -# - docker tag "$CI_REGISTRY_IMAGE:$CI_PROJECT_NAME-$IMAGE_TAG" "$CI_REGISTRY_IMAGE:$CI_PROJECT_NAME-latest" -# - docker push "$CI_REGISTRY_IMAGE:$CI_PROJECT_NAME-latest" -# only: -# - tags - -# # trigger_build: - diff --git a/README.md b/README.md index 80ce453..0755d5a 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,22 @@ # podman-dind-like + A Docker-in-Docker like container using Podman + +## Description + +This takes the quay.io/podman/stable image and extends it with some enhancements to make it more docker like +and able to use `docker` as a command as well as includes `docker-compose`. + +## Notes + +This job runs on a self-hosted gitlab agent with the following in the config.toml so this is also compatible with +other self-hosted agents for other CI/CD self-hosted agents + +``` + [runners.docker] + host = "unix:///run/podman/podman.sock" + tls_verify = false + image = "quay.io/podman/stable" + privileged = true + network_mode = "host" +``` \ No newline at end of file