Sign inSign up

rubensa/ubuntu-tini

By rubensa

•Updated 7 months ago

Docker image based on ubuntu and running tini init system

Image
Developer tools
0

2.8K

rubensa/ubuntu-tini repository overview

⁠Docker image based on ubuntu and running tini init system

GitHub repository⁠.

This is a Docker image based on ubuntu⁠ running tini⁠ init system inside a container.

⁠Building

You can build the image like this:

#!/usr/bin/env bash

DOCKER_REPOSITORY_NAME="rubensa"
DOCKER_IMAGE_NAME="ubuntu-tini"
DOCKER_IMAGE_TAG="latest"

docker buildx build --platform=linux/amd64,linux/arm64 --no-cache \
  -t "${DOCKER_REPOSITORY_NAME}/${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG}" \
  --label "maintainer=Ruben Suarez <[email protected]>" \
  .

docker buildx build --load \
  -t "${DOCKER_REPOSITORY_NAME}/${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG}" \
  .

⁠Running

You can run the container like this (change --rm with -d if you don't want the container to be removed on stop):

#!/usr/bin/env bash

DOCKER_REPOSITORY_NAME="rubensa"
DOCKER_IMAGE_NAME="ubuntu-tini"
DOCKER_IMAGE_TAG="latest"

prepare_docker_timezone() {
  # https://www.waysquare.com/how-to-change-docker-timezone/
  ENV_VARS+=" --env=TZ=$(cat /etc/timezone)"
}

prepare_docker_timezone

docker run -it \
  --name "${DOCKER_IMAGE_NAME}" \
  ${ENV_VARS} \
  "${DOCKER_REPOSITORY_NAME}/${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG}" "$@"

⁠Connect

You can connect to the running container like this:

#!/usr/bin/env bash

DOCKER_IMAGE_NAME="ubuntu-tini"

docker exec -it \
  "${DOCKER_IMAGE_NAME}" \
  bash -l

⁠Stop

You can stop the running container like this:

#!/usr/bin/env bash

DOCKER_IMAGE_NAME="ubuntu-tini"

docker stop  \
  "${DOCKER_IMAGE_NAME}"

⁠Start

If you run the container without --rm you can start it again like this:

#!/usr/bin/env bash

DOCKER_IMAGE_NAME="ubuntu-tini"

docker start \
  "${DOCKER_IMAGE_NAME}"

⁠Remove

If you run the container without --rm you can remove once stopped like this:

#!/usr/bin/env bash

DOCKER_IMAGE_NAME="ubuntu-tini"

docker rm \
  "${DOCKER_IMAGE_NAME}"

Tag summary

Content type

Image

Digest

sha256:71df70a8b…

Size

28.4 MB

Last updated

7 months ago

docker pull rubensa/ubuntu-tini