Unless otherwise noted, commands run on Ubuntu 22.


# Add the current user to the docker group so docker can be run without sudo.
sudo usermod -aG docker ${USER}
su - ${USER}


# Get installed version.
docker -v

# Verify Docker is setup / run the Hello World image.
sudo docker run hello-world

# Check whether Docker is running.
sudo systemctl status docker

# Search Docker Hub for all images matching a search term (<term>).
docker search <term>

# Show all downloaded images.
docker images

# Remove an image.
docker rmi <image-id>


# List running containers.
docker ps
# List all containers.
docker ps -a

# Start a container with <container-id> or <container-name>.
docker start <container-id>
docker start <container-name>

# Stop a container.
docker stop <container>

# Restart a container.
docker restart <container>

# Remove/delete a container.
docker rm <container>

# View container's logs.
docker logs <container>

Working with Running Containers

docker cp path/to/file <container>:./destination/path/

# Run bash on the container, if installed.
docker exec -it <container> bash


# Show disk usage.
docker system df
docker system df --verbose

# Show active container stats.
docker stats

# View and prune images.
docker image ls --filter dangling=true
docker image prune


# Stop based upon docker-compose.yml in directory.
docker compose stop

# Start services based upon docker-compose.yml.
docker compose up -d

Install on Ubuntu

On Ubuntu, from

sudo apt-get update
sudo apt-get install ca-certificates curl gnupg

sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg

echo \
  "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] \
  "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

sudo apt-get update

sudo apt-get install docker-ce docker-ce-cli docker-buildx-plugin docker-compose-plugin

# Test.
sudo docker run hello-world

docker pull ubuntu docker run -it ubuntu apt update apt install nodejs node -v exit docker commit -m "What you did to the image" -a "Author Name" container_id repository/new_image_name docker commit -m "added Node.js" -a "sammy" d9b100f2f636 sammy/ubuntu-nodejs docker images

docker login Images must follow this naming convention:


For example, these are all valid image names for the owner testuser:

docker push{owner}/{image}:{tag}

Parameter	Description
owner	The owner of the image.
image	The name of the image.
tag	The tag of the image.
For example:

docker push

docker pull{owner}/{image}:{tag}

sudo adduser --system --shell /bin/bash --gecos 'Git Version Control' --group --disabled-password --home /home/git git note UID (User ID) and GID (Group ID) numbers UID 117 GID 122 mkdir gitea && cd gitea nano docker-compose.yml

version: "3"

    external: false

    image: gitea/gitea:latest
    container_name: gitea
      - USER_UID=[uid]
      - USER_GID=[gid]
    restart: always
      - gitea
      - ./gitea:/data
      - /home/git/.ssh/:/data/git/.ssh
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
      - ""
      - ""
  • from gitea, docker-compose.yml
version: "3"

    external: false

    image: gitea/gitea:1.20.1
    container_name: gitea
      - USER_UID=117
      - USER_GID=122
    restart: always
      - gitea
      - ./gitea:/data
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
      - "8070:3000"
      - "2227:22"

docker compose up -d docker compose ps docker compose logs

have not run, but should to see what happens docker compose down

drone install:

  1. openssl rand -hex 16
    • 3f700dc23718a9e032b0baa2edc5a8f2
  2. Create OAuth app in Gitea
    • drone
    • Confidential Client
    • client id: e9af28ea-34d8-469c-887d-fcb7b8b80da4
    • client secret: gto_3mcdg6fv5ylza6i4oi7fgjpjustvxkdzfohkxognfvotqnzyzuia
  3. Allow access to Gitea port via ufw: sudo ufw allow 8070 (otherwise Drone will timeout during authorization)
    • Also allow 8071 and 8075.
  4. Install docker (from ~)
    • docker pull drone/drone:2
docker run \
  --volume=/var/lib/drone:/data \
  --env=DRONE_GITEA_CLIENT_ID=e9af28ea-34d8-469c-887d-fcb7b8b80da4 \
  --env=DRONE_GITEA_CLIENT_SECRET=gto_3mcdg6fv5ylza6i4oi7fgjpjustvxkdzfohkxognfvotqnzyzuia \
  --env=DRONE_RPC_SECRET=3f700dc23718a9e032b0baa2edc5a8f2 \
  --env=DRONE_SERVER_PROTO=http \
  --publish=8071:80 \
  --publish=8072:443 \
  --restart=always \
  --detach=true \
  --name=drone \

Fixed by ufw setting: Post "": dial tcp connect: connection timed out

docker pull drone/drone-runner-docker:1

docker run --detach \
  --volume=/var/run/docker.sock:/var/run/docker.sock \
  --env=DRONE_RPC_PROTO=http \
  --env=DRONE_RPC_HOST= \
  --env=DRONE_RPC_SECRET=3f700dc23718a9e032b0baa2edc5a8f2 \
  --env=DRONE_UI_USERNAME=root \
  --env=DRONE_UI_PASSWORD=root \
  --env=DRONE_RUNNER_NAME=my-first-runner \
  --publish=8075:3000 \
  --restart=always \
  --name=runner \

docker logs runner to verify it's running

sudo vim docker/gitea/gitea/gitea/conf/app.ini

  • repository > ENABLE_PUSH_CREATE_USER = true
  • repository > ENABLE_PUSH_CREATE_ORG = true
  • webhook > ALLOWED_HOST_LIST = private
    • the default is external which doesn't allow local ips docker restart gitea (might not be the best way)

ssh [email protected] ssh [email protected] Grade region h4d kill.

james Asdf1234.