Skip to content

A repository of Dockerfiles to be built into container environments.

License

Notifications You must be signed in to change notification settings

HenryRabelo/linux-containers

Repository files navigation

Linux Containers (Dockerfiles)

A repository of Dockerfiles to be built into container environments.

Docker Badge Kali Badge Ubuntu Badge Fedora Badge openSUSE Badge

Intro Badge Intro Badge Intro Badge Intro Badge

Introduction

This is a personal repository of Dockerfiles, made to quickly configure container environments, which are meant to be used interactively. It also demonstrates how to create & use Dockerfiles and the main docker commands, which are used in the shell script at the root directory.

Some Dockerfile configurations are altered locally before building the image, depending on what is necessary.

How to Run it

Simply give execution permissions & run the shell script located at the root directory with the desired distros as argument.

The script will pull the latest official image of the given distros and build the environment automatically. It will also create a local shell script as a command to easily run the container. Instructions:

cd linux-containers

chmod +x $(pwd)/build-container.sh
$(pwd)/build-container.sh ubuntu

run-ubuntu

How to Use it

The containers are to be used interactively, as a... contained (heh) environment for development, as a pocket distro.

When entering a container, a local user with elevation privileges will be available. For privileged actions, it will be necessary to set a password after first accessing the environment. The root account is completely locked away and inaccessible.

After setting the password, use normally as one would with any distro.

Ubuntu container in terminal window Fedora container in terminal window
Kali container in terminal window openSUSE container in terminal window

Script breakdown:
Available builds: kali ubuntu
Build container cmd ex.: ./build-container.sh ubuntu
Run container cmd ex.: run-ubuntu
____________________________________________________

## Make sure we have a clean slate, removes previously used containers  / images
docker container stop Ubuntu && docker container remove Ubuntu && docker image remove ubuntu-build
____________________________________________________

# Always pull latest base image
docker pull ubuntu &&\

## Build image from Dockerfile
docker build --force-rm --tag ubuntu-build "$(pwd)/ubuntu-dockerfile/" &&\

## Create a container from built image
docker create --name Ubuntu --interactive --tty --hostname coder --user ubuntu --volume "$HOME/.docker/Ubuntu:/home/shared" ubuntu-build &&\

## We can make either an alias or shell script to start the created container:
# echo 'alias run-ubuntu="docker start Ubuntu && docker attach Ubuntu"' >> "$HOME/.profile"
echo -e '#!/bin/sh\n'"docker start Ubuntu && docker attach Ubuntu" > "$HOME/.local/bin/run-ubuntu" && chmod +x "$HOME/.local/bin/run-ubuntu"

Back to the Top Badge

About

A repository of Dockerfiles to be built into container environments.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks