quick docker container setup guide

I created this docker compose file in a folder:
~/myfolder/docker-compose.yml

version: "1"
services:
  dev:
    image: amd64/ubuntu
    platform: linux/amd64
    volumes:
      - .:/root/myfolder2
    working_dir: /root
    cpus: 2
    network_mode: host
    security_opt:
      - seccomp:unconfined
    privileged: true
    cap_add:
      - ALL

In the same directory as my docker-compose.yml (~/myfolder/):

docker compose run --name=mycontainer dev bash

Then make the mounted folder writable:

sudo chmod +w ~/myfolder

In the container:

apt update
apt install build-essentials vim

Now I can just build things and run in the container or cross compile for the host machine.

Useful commands:

# start the container when the docker daemon is running
docker start -i mycontainer

# stop the container
docker stop mycontainer

# opens a bash container in the running container
docker exec -it mycontainer bash

# remove all stopped containers
docker container prune