Docker - VBychkov-boop/Spring-SYS265-Final-Project GitHub Wiki
A step-by-step guide to getting Grav CMS running inside Docker on a fresh Ubuntu Server VM. Written for people accessing their VM either directly via console or through PuTTY over SSH.
- Ubuntu Server 22.04 VM (Hyper-V, VMware, VirtualBox, or bare metal)
- A user account with
sudoaccess - Internet access from the VM
- A browser on another machine on the same network (to access Grav once it's running)
Power on your VM. Once the boot sequence finishes, you'll land on a login prompt that looks like this:
Ubuntu 22.04 LTS Docker01-B1 tty1
Docker01-B1 login: _
Type your username and hit Enter, then your password and hit Enter again. Nothing shows on screen when you type the password — that's normal.
Once logged in, your prompt should look something like:
youruser@Docker01-B1:~$
If you're connecting via PuTTY instead:
- Open PuTTY, enter your VM's IP, port 22, connection type SSH, click Open
- Accept the host key alert on first connection
- Log in with your username and password
- To paste commands into PuTTY — right-click (do not use Ctrl+V)
Before touching anything else, pull in the latest package lists and apply any pending updates:
sudo apt update && sudo apt upgrade -yThis can take a few minutes depending on how out of date the system is. If a dialog pops up asking about restarting services, just hit Enter to accept the defaults and move on.
sudo apt install -y ca-certificates curl gnupg lsb-releasesudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | \
sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpgecho \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] \
https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/nullsudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-pluginsudo systemctl status dockerYou want to see active (running) highlighted in green. Press Q to get back to the prompt.
Add your user to the Docker group so you don't have to type sudo in front of every Docker command:
sudo usermod -aG docker $USERApply the change to your current session without logging out:
newgrp dockerTest that it worked:
docker run hello-worldIf you see Hello from Docker! in the output, you're good to go.
mkdir ~/grav-docker
cd ~/grav-dockernano docker-compose.ymlPaste in the following config. If you're in PuTTY, right-click to paste:
services:
grav:
image: lscr.io/linuxserver/grav:latest
container_name: grav-site
restart: unless-stopped
ports:
- "8080:80"
volumes:
- grav-config:/config
environment:
- PUID=1000
- PGID=1000
- TZ=Europe/London
volumes:
grav-config:Change
TZ=Europe/Londonto match your timezone — e.g.America/New_York,Australia/Sydney,Europe/Amsterdam.
Save and close nano:
- Ctrl + O then Enter to save
- Ctrl + X to exit
docker compose up -dDocker will pull the image from LinuxServer.io — first run takes a minute or two. When it's done you'll see:
✔ Container grav-site Started
Check the container is actually up:
docker compose psgrav-site should show status Up. If it shows Exited, check the logs with docker compose logs grav to see what went wrong.
Grav doesn't include the admin UI out of the box. Drop into the container and install it:
docker exec -it grav-site bashYour prompt will change to something like root@5eaf65085f80:/# — you're now inside the container.
bin/gpm install adminType Y when it asks for confirmation. Once it finishes:
exitYou're back on the host now.
Run this on the host VM (not inside the container):
ip aFind the interface that isn't lo (loopback) — usually named eth0 or ens33. Look for the inet line under it:
2: eth0: ...
inet 192.168.1.50/24 ...
That 192.168.1.50 (yours will differ) is what you put in the browser.
Open a browser on any machine on the same network and go to:
http://192.168.x.x:8080
You should land on the Grav default page. For the admin panel:
http://192.168.x.x:8080/admin
The first time you load the admin panel it'll ask you to create an admin account — set a username and a strong password and you're in.
| What you want to do | Command |
|---|---|
| Start the stack | docker compose up -d |
| Stop the stack | docker compose down |
| View live logs | docker compose logs -f grav |
| Shell into the container | docker exec -it grav-site bash |
| Install a plugin | bin/gpm install <plugin-name> |
| Install a theme | bin/gpm install <theme-name> |
| Update Grav core | bin/gpm selfupgrade |
| Update all plugins | bin/gpm update |
| Pull latest image | docker compose pull |
| Restart the container | docker compose restart |
Can't reach the site from another machine Check if the firewall is blocking port 8080:
sudo ufw statusIf it's active, allow the port:
sudo ufw allow 8080Container keeps exiting Check the logs to see the actual error:
docker compose logs gravForgot to exit the container before running ip a
If your IP starts with 172.x.x.x you're still inside the container. Run exit first, then run ip a again on the host.
Grav admin page not loading after installing the plugin Give it 10–15 seconds and refresh. The container may need a moment to register the new plugin. If it still doesn't load, restart the container:
docker compose restart