This is a Docker image based on ubuntu running tini init system inside a container.
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 <rubensa@gmail.com>" \
.
docker buildx build --load \
-t "${DOCKER_REPOSITORY_NAME}/${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG}" \
.
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}" "$@"
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
You can stop the running container like this:
#!/usr/bin/env bash
DOCKER_IMAGE_NAME="ubuntu-tini"
docker stop \
"${DOCKER_IMAGE_NAME}"
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}"
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}"