Skip to content

Docker

# Build the image for multiple architectures
docker buildx build --platform linux/amd64,linux/arm64,linux/armv7 -t myregistry/myimage:latest .
docker buildx push --platform linux/amd64,linux/arm64,linux/armv7 myregistry/myimage:latest
docker run --rm -v $(pwd):/app composer
Terminal window
docker run --rm -it ubuntu /bin/bash
Terminal window
sudo docker network create my_docker_network --subnet 172.46.0.0/20

Run a container on the freshly created network with a custom IP

Section titled “Run a container on the freshly created network with a custom IP”
Terminal window
docker run --rm --net my_docker_network --ip 172.46.0.1 -p 8080:80 nginx

When using UFW, allow the traffic to the previously created container

Section titled “When using UFW, allow the traffic to the previously created container”
Terminal window
sudo ufw route allow proto tcp from any to 172.46.0.1 port 80
Terminal window
curl http://{public_ip}:8080 ## Should return the nginx welcome page
Terminal window
docker volume rm `docker volume ls -q -f dangling=true`