Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker maclvn network #139

Open
E1t2han opened this issue May 29, 2024 · 3 comments
Open

Docker maclvn network #139

E1t2han opened this issue May 29, 2024 · 3 comments

Comments

@E1t2han
Copy link

E1t2han commented May 29, 2024

Operating system

ubuntu 24.04 arm

Description

I use the command docker network create -d macvlan --subnet=192.168.0.0/24 --gateway=192.168.0.1 -o parent=end1 vlan
created docker maclvn network, when I use the command docker compose up ,the container (windows 11 arm) started successful,but I Couldn't access the container from the web http://localhost:8006/, If I delete the networks in docker-compose.yml, I Can access the container from the web http://localhost:8006/ successful, I want to use the RDP to connect the container,can you help me?

Docker compose

services:
windows:
container_name: windows
image: dockurr/windows-arm
environment:
VERSION: "win11"
RAM_SIZE: "8G"
CPU_CORES: "4"
DISK_SIZE: "256G"
devices:
- /dev/kvm
device_cgroup_rules:
- 'c : rwm'
cap_add:
- NET_ADMIN
ports:
- 8006:8006
- 3389:3389/tcp
- 3389:3389/udp
stop_grace_period: 2m
restart: on-failure
networks:
vlan:
ipv4_address: 192.168.0.150

networks:
vlan:
external: true

Docker log

Image_1716997821557
Image_1716997818960

Screenshots (optional)

Image_1716996505432
Image_1716996512186
Image_1716996521068

@kroese
Copy link
Contributor

kroese commented May 29, 2024

If you use macvlan you cannot connect to localhost, but you must do it to 192.168.0.150 instead.

So try http://192.168.0.150:8006

@E1t2han
Copy link
Author

E1t2han commented May 30, 2024

I access the container from the web http://192.168.0.150:8006,but I still couldn't acess the container,my box is Nanopc T6(cpu: RK 3588),thanks!Image_1717066462804.png

Image_1717066945791.png

@kroese
Copy link
Contributor

kroese commented May 30, 2024

With macvlan you cannot reach that IP from the host (this is described in the FAQ, and also a solution is given). Normally this is not a problem, because people run the container on their server, and access the IP from their desktop/laptop. But from the screenshots it looks like you are running the browser on the same machine where the docker is running.

So go to http://192.168.0.150:8006/ from another machine in your network (your mobile phone for example) and confirm it works. After that you can apply the workaround as described in the FAQ to also make it work from the same machine, but its a little bit complicated.

I dont even understand why you enabled macvlan in the first place, because if you only need access from the same machine, then macvlan has no real advantage over the default bridge networking with localhost.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants