add-container
Table of Contents
Adding a container
Create SCSI disk
- Log into vm.garynet.org
- Datacenter > vm > as.garynet.org > Hardware
- Add > Hard Disk
- Bus/Device: SCSI
- Storage: pool1
- Disk size: Depends on use
- Click Add
Partition new disk
- Make mnt point directory with:
mkdir /mnt/docker/<container> - Find disk with
fdisk -l - Partition disk with
cfdisk <disk>- Select type gpt
- New and set max size
- Select write and type yes
- Quit
- Format partition with
mkfs.ext4 /dev/<disk>1 - Find UUID with
blkid - Add disk to fstab with
vim /etc/fstab:UUID=<uuid> /mnt/docker/<container> auto rw,user,auto 0 0
- Verify no errors with
findmnt –verify - Reload systemd daemon with
systemctl daemon-reload - Mount disk with
mount -a
Setup compose file
- Make folder to contain docker compose files in /mnt/docker-compose-files/container_name-domain-tld
- Add docker compose file to /mnt/docker-compose-files/container_name-domain-tld
- This can be created manually or downloaded from a project page online.
- Add following entries to docker-compose.yml:
Inside service section
Required for posterity.
container_name: container_name-domain-tld
This will restart your container on a server reboot.
restart: unless-stopped
Make sure you set any volumes that your container requires to the disk you created earlier!
volumes: - /mnt/docker/example/data:/example_data - /mnt/docker/example/db:/example_db
Required to reach your container via DNS and will enable TLS.
labels: - traefik.enable=true - traefik.http.routers.container_name-domain-tld.rule=Host(`<subdomain>.domain.tld`) - traefik.http.services.container_name-domain-tld.loadbalancer.server.port=<port> - traefik.http.routers.container_name-domain-tld.entrypoints=websecure - traefik.http.routers.container_name-domain-tld.tls.certresolver=domain-tld-certresolver
Required for traefik to route to your container.
networks: - container_name-domain-tld_net - proxy_net
Outside the service section
Required for docker to create networks.
networks: container_name-domain-tld_net: name: container_name-domain-tld_net proxy_net: name: proxy_net external: true
add-container.txt · Last modified: by lucasrufkahr
