A ready-to-use Ubuntu development environment with MySQL, plus optional GUI app support on macOS (Apple Silicon or Intel). It ships with simple scripts to start, backup, and restore your environment reproducibly.
- 🐧 Ubuntu 22.04 amd64 container
- 🗄️ MySQL 8.0 with persistent storage
- 🔁 One-command backup (image + tar) and restore
- 🖥️ GUI app support on macOS via XQuartz
- 📂 Host folder
./sharedmapped to/home/<username>/sharedinside the container
-
Docker Desktop installed and running
-
macOS only (for GUI apps): Install XQuartz
-
Open XQuartz → Preferences → Security, enable Allow connections from network clients
-
In a macOS terminal (outside the container) run once:
xhost + 127.0.0.1
-
./start.sh- On first run, you’ll be asked for your Ubuntu username and password.
- The script will start the Ubuntu and MySQL containers.
- A host folder
./sharedis mounted into the container at/home/<your_username>/shared. - You’ll be attached as the created user to an interactive login shell inside the container.
./start.sh [options]Options
-
No args — start/attach to the environment; prompt on first run.
-
--recreate— forcefully recreate the Ubuntu container from the current image (no pull/build). -
--restore <backup.tar>— restore from a backup tar produced bybackup.sh../start.sh --restore backups/env-ubuntu-backup-20250912-143000.tar
-
--restore <image:tag>— restore from a local image tag (also produced bybackup.sh)../start.sh --restore env-ubuntu:backup-20250912-143000
-
-h, --help— show usage.
Under the hood,
--restoreretags your backup toenv-ubuntu:latestand recreates without building so your restored filesystem isn’t overwritten.
mysql -h mysql-server -P 3306 -u root -pDefaults (from compose.yml):
- Root password: db
- Also provisioned: database db, user db, password db
-
Ensure XQuartz is installed and running.
-
In XQuartz: Preferences → Security → Allow connections from network clients.
-
In macOS terminal (once):
xhost + 127.0.0.1
-
Inside the Ubuntu container try:
xeyes
(or
xclock, etc.)
Create a backup (image + tar):
./backup.shThis will:
-
Commit the current container filesystem to an image:
env-ubuntu-backup:<timestamp> -
Also tag a convenience image:
env-ubuntu:backup-<timestamp> -
Save a tar file under
./backups/, e.g.:backups/env-ubuntu-backup-20250912-143000.tar
-
No args — create a timestamped backup (image + tar).
-
--name <suffix>— custom suffix instead of timestamp../backup.sh --name myproject
Produces:
backups/env-ubuntu-backup-myproject.tar image tag: env-ubuntu:backup-myproject
-
From tar:
./start.sh --restore backups/env-ubuntu-backup-20250912-143000.tar
-
From image tag:
./start.sh --restore env-ubuntu:backup-20250912-143000
Created automatically on first run (or you can edit manually):
USER_NAME=<your_username>
USER_UID=1000
USER_GID=1000
HOST_DATA_PATH=./shared
CONTAINER_DATA_DIR=/home/<your_username>/shared
USER_PASSWORD=<your_password>
USER_PASSWORDis stored in plaintext in.env(by design here). If you want a safer approach, switch to Docker secrets and remove this line.
.
├─ compose.yml
├─ Dockerfile
├─ entrypoint.sh
├─ start.sh
├─ backup.sh
├─ .env # auto-created on first run
├─ shared/ # host<->container shared folder
└─ backups/ # backup tars (from backup.sh)
-
WARN: The "USER_PASSWORD" variable is not setEnsure.envcontains a line:USER_PASSWORD=yourpasswordThen re-run
./start.sh. -
service "mysql" refers to undefined volume ...If you changed the volume name underservices.mysql.volumes, also define it at the bottom undervolumes:(names must match). -
Restoring doesn’t seem to apply Use
./start.sh --restore <backup.tar|image:tag>. The script retags toenv-ubuntu:latestand recreates with--no-build --pull=neverto avoid clobbering the restored filesystem. -
Entering as root / no colors
start.shattaches as your created user with colored prompt/ls. If you still see no colors, ensure you’re attached withbash -il(the script already does this). -
Validate Docker Compose config
docker compose -f compose.yml config
This project is provided as-is, without warranty. Use at your own risk.