Glad to see that QNAP including the docker and lxc support starting from QTS 4.2. Just imported the LXC of ubuntu 14.04 for testing. It is using a NAT subnet for the container by default. Seem that there is no way to change it to bridge network. May I ask the how to setup port forward?
Thanks!
Mac
Port Forward setup for LXC
-
- Starting out
- Posts: 41
- Joined: Fri Oct 31, 2014 5:43 am
- Location: Germany - DD
Re: Port Forward setup for LXC
Hi Mac,
Did you solve this?
I want to run Jenkins in a container that uses my NAS' SVN server with svn:// Syntax. However, all containers I tried (Jenkins, Ubuntu) cant't even ping my NAS' IP. Seems the containers do get a 10.30.x.x IP while my NAS is on 192.168.178.x.
Cheers
Did you solve this?
I want to run Jenkins in a container that uses my NAS' SVN server with svn:// Syntax. However, all containers I tried (Jenkins, Ubuntu) cant't even ping my NAS' IP. Seems the containers do get a 10.30.x.x IP while my NAS is on 192.168.178.x.
Cheers
QNAP TS-451 Firmware 4.2.0 b0925
4x WD RED 4TB (RAID5)
4x WD RED 4TB (RAID5)
-
- Starting out
- Posts: 16
- Joined: Wed May 13, 2015 10:13 am
Re: Port Forward setup for LXC
I'm wondering; looks like once you create a container, you cannot change the port forwards? at least not in the UI...
Nice .. but limited
Nice .. but limited
- demure
- New here
- Posts: 2
- Joined: Wed Feb 08, 2017 4:32 am
Re: Port Forward setup for LXC
I know I'm double posting this (different thread), but this thread is the top google hit, so:
I did some digging, and you can manually fix it from the command line.
In my case, I was using an lxc, which will be named 'debian'.
In (where CHACHEDEV1 is the root of my raid6, and 'debian' is the root of the image), you will find a qnap.json.
Here is a 'bad' file:
And here is one with a working port forward readded:
Format of is EXTERIOR, CONTAINER, tcp/udp. I didn't bother to dig into multiple, but I assume it would be
I did some digging, and you can manually fix it from the command line.
In my case, I was using an lxc, which will be named 'debian'.
In
Code: Select all
/share/CACHEDEV1_DATA/containers/container-station-data/lib/lxc/debian
Here is a 'bad' file:
Code: Select all
{"volume": {"new": [], "host": {}, "container": []}, "version": "8", "resource": {"device": [], "limit": {}}, "name": "deleteme", "autostart": true, "arch": "amd64", "image": "debian-jessie", "type": "lxc", "network": {"hostname": "debian", "port": [], "mode": "nat"}}
Code: Select all
{"volume": {"new": [], "host": {}, "container": []}, "version": "8", "resource": {"device": [], "limit": {}}, "name": "deleteme", "autostart": true, "arch": "amd64", "image": "debian-jessie", "type": "lxc", "network": {"hostname": "deleteme", "port": [[1111, 22, "TCP"]], "mode": "nat"}}
Code: Select all
[[1111, 22, "TCP"]]
Code: Select all
[[FIRST], [SECOND], [ETC...]]
-
- First post
- Posts: 1
- Joined: Wed Apr 12, 2017 8:10 pm
Re: Port Forward setup for LXC
demure -- thanks for digging.
Confirmed that multiple ports are in the format you specified:
e.g.
would forward TCP 11 and UDP 12 from host to container.
Confirmed that multiple ports are in the format you specified:
e.g.
Code: Select all
"network": {"port": [[11, 11, "TCP"], [12, 12, "UDP"]], "mode": "nat"}}