Skip to content

Instantly share code, notes, and snippets.

@cmbaughman
Last active May 3, 2024 14:56
Show Gist options
  • Save cmbaughman/8d592ea4564efb5e5edbbe302cfe3960 to your computer and use it in GitHub Desktop.
Save cmbaughman/8d592ea4564efb5e5edbbe302cfe3960 to your computer and use it in GitHub Desktop.
Install Docker on Ubuntu and using Windows 11

Installing Docker on Ubuntu

Setup

  1. Make sure you have gnome-terminal installed:
sudo apt install gnome-terminal
  1. Get rid of older versions if you have them:
for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove $pkg; done
  1. Run this in terminal
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc

# Add the repository to Apt sources:
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
  $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
  1. Finally install Docker
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
  1. Create the docker user group: sudo groupadd docker
  2. Add your user to the docker group: sudo usermod -aG docker $USER
  3. Test that you can run without root: docker run hello-world

If all that goes well, you will see a Hello from Docker! message saying that you have everything set up correctly.

Running a Win11 gui with Docker

  1. Create a folder: mkdir win11 && cd win11
  2. Insert this exactly (including spaces) into a file named docker-compose.yml:
version: "3"
services:
  windows:
    image: dockurr/windows
    container_name: windows
    environment:
      VERSION: "win11"
    devices:
      - /dev/kvm
    cap_add:
      - NET_ADMIN
    ports:
      - 8006:8006
      - 3390:3389/tcp
      - 3390:3389/udp
    stop_grace_period: 2m
    restart: on-failure

  1. From the win11 directory that you just created, run:
docker compose up
  1. Leave that open, it may look crazy while it downloads and when it's running. If you see that there are no more messages happening, that means it should be ready or almost ready for the next step.
  2. Open rdp, krdc, or whatever your favorite remote desktop app is and connect to:
  • Machine name: 0.0.0.0:3390
  • User: docker
  • __Password: (leave this blank)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment