CasaOS MAC_Vlan error assigining the network to a container

Im trying to apply MAC VLAN network to particular Container, but Im getting an error. Can anybody help me with this? I did search for solution but nothing helped so far… Networking in docker is a bit mess…
in fact, I cant use DNS name inside my NginX proxy - they just dont work, Im thinking its cuz Im using AdguardHome, and I had to disable :53 resolver in debian to let AGH working as expetced…

I did create new Network like this:
docker network create -d macvlan --attachable --subnet 10.192.168.0/24 --gateway 10.192.168.1 --ip-range 10.192.168.168/32 -o parent=enp0s31f6 Mvlan_10.192.168.168

This is normally because you tried to change the network in the CasaOS App Settings. You should edit the Docker compose file without using the CasaOS UI.

Thx for reply.

Script does work - but im stacked at point where im not sure how to implement new network. I have created new network like tihis:

docker network create -d macvlan --attachable --subnet 10.192.168.0/24 --gateway 10.192.168.1 --ip-range 10.192.168.168/32 -o parent=enp0s31f6 Mvlan_10.192.168.168

root@debian:/home/user# docker network inspect Mvlan_10.192.168.168
[
{
“Name”: “Mvlan_10.192.168.168”,
“Id”: “b6cbefb33c915421caca4a5e25ab5f841a8743576d55ad7d4d5c83144a29d7ed”,
“Created”: “2024-03-19T16:33:59.792217443+01:00”,
“Scope”: “local”,
“Driver”: “macvlan”,
“EnableIPv6”: false,
“IPAM”: {
“Driver”: “default”,
“Options”: {},
“Config”: [
{
“Subnet”: “10.192.168.0/24”,
“IPRange”: “10.192.168.168/32”,
“Gateway”: “10.192.168.1”
}
]
},
“Internal”: false,
“Attachable”: true,
“Ingress”: false,
“ConfigFrom”: {
“Network”: “”
},
“ConfigOnly”: false,
“Containers”: {},
“Options”: {
“parent”: “enp0s31f6”
},
“Labels”: {}
}
]

Then I applied your script to edit YAML and:
section of container with the network:

devices:
cap_add:
environment:
privileged: false
container_name: “”
hostname: “”
network_mode: bridge <----tried put mcvlan
networks:
Mvlan_10.192.168.168: <----- tried name of new network
name: Mvlan_10.192.168.168 <----- same as above. # none work. Still same ERROR
x-casaos:
architectures:
- amd64
- arm64
author: BigBearTechWorld
category: BigBearCasaOS

SO:

network_mode: macvlan
networks:
Mvlan_10.192.168.168:
name: Mvlan_10.192.168.168

it doesnt work - error “no deamon found for that network” <— error showed in GUI

You’re welcome.

When using Docker Compose to connect a container to a macvlan network, you should specify the network under the networks section at the bottom of your docker-compose.yml file and then reference it under the service that needs to use it.

  1. Define the External Network in Docker Compose: Since you’ve already created the network outside of Docker Compose with the docker network create command, you’ll need to declare it as an external network in your docker-compose.yml. This tells Docker Compose that the network is defined outside the compose file and should be used as-is.

  2. Assign the Network to Your Service: Then, you need to specify which service should be attached to this external network.

Example

version: '3.8'
services:
  your_service_name:  # Replace with your actual service name
    image: your_image  # Replace with the image you want to use
    networks:
      - Mvlan_10.192.168.168  # Use the name of the external network

networks:
  Mvlan_10.192.168.168:
    external: true
    name: Mvlan_10.192.168.168  # This should match the name of the network you created

Now I’ve something like this:

image: stonith404/pingvin-share:latest
labels:
icon: https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons/png/pingvin.png
networks:
- Mvlan_10.192.168.168
ports:
- mode: ingress
target: 3000
published: “3487”
protocol: tcp
restart: unless-stopped
volumes:
- type: bind
source: /DATA/AppData/pingvin-share/data
target: /opt/app/backend/data
bind:
create_host_path: true
- type: bind
source: /DATA/AppData/pingvin-share/images
target: /opt/app/frontend/public/img
bind:
create_host_path: true
x-casaos:
ports:
- container: “3000”
description:
en_us: ‘Container Port: 3000’
volumes:
- container: /opt/app/backend/data
description:
en_us: ‘Container Path: /opt/app/backend/data’
- container: /opt/app/frontend/public/img
description:
en_us: ‘Container Path: /opt/app/frontend/public/img’
networks:
Mvlan_10.192.168.168:
external: true
name: Mvlan_10.192.168.168
x-casaos:
architectures:
- amd64
- arm64
author: BigBearTechWorld

It didnt work. Im fighting with this cuz I cant use domain names inside the containers, cuz Im using ADGuard Home inside the container and I had to disable local resolver to make AGH work. I dont know who design networking in docker but was drugged :smiley: