How to create a local network mapping in linux I'm deploying nextcloud via docker, however the way the configuration is set up, it creates a subnetwork at 10.10.10.0/24 on the system it's running on instead of running it on 127.0.0.1. Then the only way to access it is by navigating to 10.10.0.5 on the host machine.
However, I want to be able to access this image from every machine on my local network.
I already have a few things running, so I need to map the port as well.
Is there an intuitive way to map the network such that navigating to 127.0.0.1:2287 maps it to 10.10.0.5? I can't seem to find anything indicating how to do this.
I would think this would have to be a bidirectional mapping since it needs to send data back since it's nextcloud, but I'm unsure about this.
I did try setting up the docker container to report to 127.0.0.1 but it didn't work out. It would only report on 172.19.0.5
If you wanted to see my docker setup, it's as follows:

Create the subnetwork for docker: docker network create --driver=bridge --subnet=10.10.10.0/24 --gateway=10.10.10.1 dockernet

Run docker-compose


version: '3' 

services:
  nextclouddb:
    image: mariadb
    container_name: nextcloud-mariadb
    volumes:
      - /home/username/data/mysql:/var/lib/mysql
      - /etc/localtime:/etc/localtime:ro
    networks:
      default:
        ipv4_address: 10.10.10.4
    environment:
      - MYSQL_ROOT_PASSWORD=STONGPASSWORD
      - MYSQL_PASSWORD=ANOTHERSTONGPASSWORD
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
    restart: unless-stopped
  
  nextcloudapp:
    image: nextcloud:latest
    container_name: nextcloud-app
    networks:
      default:
        ipv4_address: 10.10.10.5
    volumes:
      - /home/username/data/html:/var/www/html
      - /home/username/data/config:/var/www/html/config
      - /home/username/data/apps:/var/www/html/custom_apps
      - /home/username/data/data:/var/www/html/data
      - /home/username/data/themes:/var/www/html/themes
      - /etc/localtime:/etc/localtime:ro
    restart: unless-stopped

networks:
  default:
    external:
      name: dockernet
Do you have network constraints to create a new subnet or what is the reason?
if it's not useful at all, you can just map the port and open the firewall of your PC so that the other machines can see the application.
version: '3' 
services:
  nextclouddb:
    image: mariadb
    container_name: nextcloud-mariadb
    volumes:
      - /home/username/data/mysql:/var/lib/mysql
      - /etc/localtime:/etc/localtime:ro
    environment:
      - MYSQL_ROOT_PASSWORD=STONGPASSWORD
      - MYSQL_PASSWORD=ANOTHERSTONGPASSWORD
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
    restart: unless-stopped
  
  nextcloudapp:
    image: nextcloud:latest
    container_name: nextcloud-app
    volumes:
      - /home/username/data/html:/var/www/html
      - /home/username/data/config:/var/www/html/config
      - /home/username/data/apps:/var/www/html/custom_apps
      - /home/username/data/data:/var/www/html/data
      - /home/username/data/themes:/var/www/html/themes
      - /etc/localtime:/etc/localtime:ro
    restart: unless-stopped
    ports:
      - 2287:80