Create a Docker container running Ubuntu 23.04 LTS with some preinstalled packages useful for development.
First, make sure you have Docker installed. Docker must be running whenever you want to install or use the container.
-
Navigate to your desired installation directory. This will be the directory on your host machine which you will have access to from the container (located at
~/host/
).For instance, in your terminal:
cd ~/Desktop/myfolder/
-
Clone this repo and move the files into your desired installation directory.
git clone https://github.com/nathanaeng/docker-myubuntu mv ./docker-myubuntu/* . && rm -rf ./docker-myubuntu
-
Give proper permissions to
startup.sh
and run the script. This will also create an alias in~/.zshrc
calledubuntu
which you can type in the terminal from now on to start and attach to your Docker container (from any directory - however the original installation directory will still be the only once accessible from inside the container). Note: you will need to restart the terminal or runsource ~/.zshrc
to use this alias.chmod +x startup.sh ./startup.sh
This may take several minutes depending on your internet connection.
You can now get to developing! You can install any other desired packages with sudo apt-get install <PACKAGE_NAME>
. The default username and password are both myubuntu
. These values can be changed in startup.sh
.
The default container name, username, password, and alias are all stored in startup.sh
. You can change these values, but if you have already created the container you must run the following commands:
ubuntu delete
ubuntu
The image name located in startup.sh
pertains to the name of the Docker image used to create the container. Changing the image name will not have any affect on your usage of the container so it is advised to not change this value.
Upon starting the container, you can run the following to configure Powerlevel10k to your liking:
p10k configure
There is a default .vimrc
provided, but this can be changed at any time.
It is probably safest and most performant to save the majority of your work in the host directory rather than in the container itself. Rather, the intended use of this container is for testing your actual code.
To stop the container, return to your host terminal by typing exit
or Ctrl + P + Q
in the Docker terminal and then run
ubuntu stop
To restart the container at any time, run the following command in your terminal from any directory:
ubuntu