2025-06-07 08:35:46 +02:00
# My Hack Environment in a Docker Container
2025-06-04 02:06:41 +02:00
2025-06-08 00:00:56 +02:00
This container image is based on "alpine:3.22".
Why Alpine? Because Alpine Linux is definitely the best Linux based operating system distribution I ever have used since 1999!
2025-06-06 23:31:47 +02:00
Why the name "rusty"? Because it is based on some earlier Docker stuff I made for compiling Rust code... And rusty just sounds cool.
2025-06-08 00:35:43 +02:00
It still includes a full Rust environment/SDK! You need to add "/usr/local/cargo/bin" to your $PATH if you want to make use of it; For user "root" it is done by Docker.
2025-06-08 00:00:56 +02:00
Why Rust? Because I really like this language...
2025-06-06 23:31:47 +02:00
My plan is to switch from Docker to native Linux Containers at some time but I am faster in building the prototype using Docker... ;)
2025-06-07 08:40:49 +02:00
## Prerequisites
* Docker...! What a wonder... :)
2025-06-07 08:51:57 +02:00
* Be sure to be a member of the docker group. Else you need to do all the next steps as user root. I will not cover this here!
2025-06-07 08:40:49 +02:00
2025-06-06 23:31:47 +02:00
## Get the code
git clone https://git.xw3.org/hanez/rusty
2025-06-07 02:13:05 +02:00
# or
2025-06-07 08:51:57 +02:00
git clone git@git .xw3.org:hanez/rusty.git # (needs an account on git.xw3.org)
2025-06-06 23:31:47 +02:00
cd rusty
2025-06-27 08:07:18 +02:00
## Prepare the environment (This is totally wrong! Give me some time... ;))
2025-06-07 02:13:05 +02:00
mkdir -p home/$USER
chown $USER:$USER home/$USER
2025-06-07 04:34:40 +02:00
chmod 0750 home/$USER
2025-06-07 08:35:46 +02:00
sudo chown root:root home
sudo mkdir root
sudo chown root:root root
2025-06-07 02:13:05 +02:00
## Configure your environment (Optional)
2025-06-07 08:51:57 +02:00
Optionally you can configure your $HOME directories (/home/$USER and /root). I do this by pulling my $HOME configuration from my Git server. Pulling my $HOME configuration will not work for you because you are not allowed to pull via the Git protocol. This is just an example on how I do it... E.g.:
2025-06-07 02:13:05 +02:00
2025-06-08 00:35:43 +02:00
git clone git@git .xw3.org:hanez/home.git home/hanez
sudo git clone git@git .xw3.org:hanez/home.git root
2025-06-07 08:35:46 +02:00
I manage these Git based $HOME directories/repositories outside of the container.
2025-06-08 00:35:43 +02:00
If you do not configure your $HOME directories here, the container creates missing configuration files.
2025-06-07 02:13:05 +02:00
2025-06-08 04:05:24 +02:00
### Create SSH key file
Create a private key without a password.
2025-06-27 08:07:18 +02:00
ssh-keygen -N "" -f home/$USER/.ssh/ed25519
2025-06-08 04:05:24 +02:00
2025-06-06 23:31:47 +02:00
## Using docker compose
docker compose build
docker compose up -d
2025-06-08 00:00:56 +02:00
docker attach rusty
2025-06-06 23:31:47 +02:00
2025-06-07 08:51:57 +02:00
You can stop the container by executing "exit" or by hiting ctrl+c when attached. You can always detache the container when hiting ctrl+p and then ctrl+q. This is useful if you have a screen or a tmux session runningin your container, or maybe some other applications.