How to create a docker container under the same network with qnap nas?

This article talks about how to create a docker container under the same network with qnap, just like container is another device under your LAN.

create docker container under same network with qnap

How to create a container under the same network with QNAP, we mainly introduce two methods:

Method 1 Container staition GUI

  1. Enter the qnap backend, open the container staition and click “create”, search for the application and click “install”
  1. Enter the installation page, click “advanced settings”
  1. Specify the network mode as “bridge”, and select the correct network card, default option is DHCP i.e. dynamic ip
  1. Switch to static ip

Method 2 Docker compose

  1. Open container station and click “create”, then click “create application”
  1. Edit docker-compose

The most important thing here is to know to fill in the network to correct physical network card, which will be described in the following section:

version: '3'
networks:
  qnet-dhcp-eth0:
    external: true

services:
  ubuntu:
    image: ubuntu:20.04
    container_name: ubuntu
    volumes:
      - /share/Container/ubuntu/root:/root
    command: "tail -f /dev/null"
    networks:
      qnet-dhcp-eth0
    restart: unless-stopped
  1. Use ssh to enter the nas remotely, execute the command below, there will be a network named like “qnet-dhcp”, which is the network name we are looking for, and fill in the networks field above.

Premise: We have already created a bridge mode + DHCP container before using the first method of this article. This network will be automatically created. If not, check the instructions from the appendix link at the end of the article.

$ docker network ls
NETWORK ID     NAME                    DRIVER    SCOPE
8b559890874c   bridge                  bridge    local
f02fc3fded21   host                    host      local
dc5a76ee7c50   none                    null      local
8eddf8952a98   portainer_default       bridge    local
41dfa6d5ad2b   qnet-dhcp-eth0          qnet      local

For details on QNET(similar to macvlan), refer to: https://qnap-dev.github.io/container-station-api/qnet.html

Post a Comment

0 Comments