is there a way to make every new container take its Ip from my dhcp server?Yes this is of course possible, and sometimes needed, However, i made the mistake in the beginning as well to assign every single container its own static ip, which is not needed.
Typically, one just assigns a port to the container and than you can access the container via http://rancherosip:port, if you want to have s host-ip you'll have to start the container via --net=host and when you define the port you have to use 192.168.0.XX:1337:80 or similar. Better check the official docker wiki for more info.
is there a way to make every new container take its Ip from my dhcp server?
like change bridging and make it with eth0 maybe ?
in corral it was doing that (i'm migrating from corral btw)
I was trying to use rancher GUI and pull them from https://hub.docker.com/myuser/myrepositoryyes that should be possible. how do you deploy your containers?
I was trying to use rancher GUI and pull them from https://hub.docker.com/myuser/myrepository
with network set to bridge and/or host(the same RancherOS VM), but with no success on accessing them.
docker run -d -it --label io.rancher.container.dns=true --label io.rancher.container.network=true --hostname ghost --name ghost -p 2368:2368
docker network create --subnet 203.0.113.0/24 --gateway 203.0.113.254 iptastic
docker run --rm -it --net iptastic --ip 203.0.113.2 nginx
I'll need to give this a shot next. I kind of assumed that was what the bridge network in Docker did, but apparently not. Thanks!If you want to play with static ip addresses you could try the following:
# create a new bridge network with your subnet and gateway for your ip block
docker network create --subnet 203.0.113.0/24 --gateway 203.0.113.254 iptastic
# run a nginx container with a specific ip in that block
docker run --rm -it --net iptastic --ip 203.0.113.2 nginx
docker create \ --name=plex \ --net=host \ -e VERSION=latest \ -e PUID=<UID> -e PGID=<GID> \ -e TZ=<timezone> \ -v </path/to/library>:/config \ -v <path/to/tvseries>:/data/tvshows \ -v </path/to/movies>:/data/movies \ -v </path for transcoding>:/transcode \ linuxserver/plex
100% on the money about that.Hi,
There are some containers where you have to use certain things, plex for example has to have advertise-ip set as an environmental variable, and must run in host networking or so. You'll have to check in the plex container documents on hub.docker.com, or Google how it is being deployed.
But the majority of docker containers absolutely don't need it. Just check my image from earlier. I have plenty of containers deployed. Just by the port exposure.
Code:docker create \ --name=plex \ --net=host \ -e VERSION=latest \ -e PUID=<UID> -e PGID=<GID> \ -e TZ=<timezone> \ -v </path/to/library>:/config \ -v <path/to/tvseries>:/data/tvshows \ -v </path/to/movies>:/data/movies \ -v </path for transcoding>:/transcode \ linuxserver/plex
--net=host is required
100% on the money about that.
My setup is up and running now with all my containers just how it used to run on Corral. Thank you, kind sir (or madam; you never can be truly sure on the internet), for all you've provided in helping me on my journey. I think I've got the hang of things now. I just wish Portainer would allow for editing containers instead of me having to recreate them from scratch each time I make a mistake. I understand that's in the works though.
Thanks again!
Sent from my iPhone using Tapatalk
host shares: ------ iohyve:RancherOS ----- inside the container @192.168.0.2 @192.168.0.16 /mnt/zpool/docker /mnt/docker :volumes in docker-compose.yml /mnt/zpool/dbs /mnt/dbs /mnt/zpool/data /mnt/data
version: '2' services: mariadb: image: linuxserver/mariadb hostname: mariadb environment: PGID: '1000' PUID: '1000' MYSQL_ROOT_PASSWORD: 'passwordofyourchoice' TZ: 'Europe/Berlin' stdin_open: true tty: true ports: - 3306:3306/tcp labels: io.rancher.container.pull_image: always nextcloud: image: linuxserver/nextcloud hostname: nextcloud environment: PGID: '1000' PUID: '1000' volumes: - /mnt/docker/rancher/nextcloud:/config - /mnt/data/sorted-data/scientific-data:/scientific-data stdin_open: true tty: true ports: - 2480:80/tcp - 2443:443/tcp labels: io.rancher.container.pull_image: always freshrss: image: linuxserver/freshrss hostname: freshrss environment: PGID: '1000' PUID: '1000' TZ: 'Europe/Berlin' volumes: - /mnt/docker/rancher/freshrss:/config stdin_open: true tty: true ports: - 2280:80/tcp labels: io.rancher.container.pull_image: always ghost: image: ghost hostname: ghost volumes: - /mnt/docker/rancher/ghost:/var/lib/ghost stdin_open: true tty: true ports: - 2368:2368/tcp labels: io.rancher.container.pull_image: always
version: '2' services: mariadb: scale: 1 start_on_create: true nextcloud: scale: 1 start_on_create: true freshrss: scale: 1 start_on_create: true ghost: scale: 1 start_on_create: true
I have been playing with the nfs-client docker and it never worked for me with multiple nfs-whatever.yml for me only the last nfs file was loaded every time. So in order to mount multiple volumes from NFS shares you'll have to write one nfs.yml which should contain the following
Code:#/var/lib/rancher/conf/cloud-config.d/nfs.yml write_files: - path: /etc/rc.local permissions: "0755" content: | #!/bin/bash [ ! -e /usr/bin/docker ] && ln -s /usr/bin/docker.dist /usr/bin/docker rancher: services: nfs: image: d3fk/nfs-client labels: io.rancher.os.after: console, preload-user-images io.rancher.os.scope: system net: host privileged: true restart: always volumes: - /usr/bin/iptables:/sbin/iptables:ro - /mnt/mm:/mnt/mm:shared - /mnt/docker:/mnt/docker:shared - /mnt/dbs:/mnt/dbs:shared environment: SERVER: 192.168.0.2 SHARE: /mnt/volume01/multimedia MOUNTPOINT: /mnt/mm #cloud-config mounts: - ["192.168.0.2:/mnt/volume01/docker", "/mnt/docker", "nfs", ""] - ["192.168.0.2:/mnt/volume01/db", "/mnt/dbs", "nfs", ""]
The first part create 3 volumes to mount into namely /mnt/mm, /mnt/dbs, and /mnt/docker and mounts 192.168.0.2:/mnt/volume01/multimedia to /mnt/mm. After this is done and only after this docker is loadedsudo mount -t nfs 123.123.123.123:/wtf /mnt/wtf
will work on RancherOS, then it is possible to add the mounts into the cloud config. This can all be done in the nfs.yml file.
After creating the yml file always check at least the formating usingsudo ros config validate -i wtf.yml
if there is a formating error you will receive a message. e.g.
> FATA[0000] yaml: [while parsing a block collection] did not find expected '-' indicator at line 6, column 3
#/var/lib/rancher/conf/cloud-config.d/nfs.yml write_files: - path: /etc/rc.local permissions: "0755" content: | #!/bin/bash [ ! -e /usr/bin/docker ] && ln -s /usr/bin/docker.dist /usr/bin/docker rancher: services: nfs: image: d3fk/nfs-client labels: io.rancher.os.after: console, preload-user-images io.rancher.os.scope: system net: host privileged: true restart: always volumes: - /usr/bin/iptables:/sbin/iptables:ro - /mnt/config:/mnt/config:shared - /mnt/media:/mnt/media:shared environment: SERVER: 192.168.1.21 SHARE: /mnt/MyVolume/docker MOUNTPOINT: /mnt/config #cloud-config mounts: - ["192.168.1.21:/mnt/MyVolume/Media", "/mnt/media", "nfs", ""]
as far as the yaml syntax goes its correct, and sudo ros config validate -i nfs.yml was fine.File looks OK at first glance. Does it validate correctly with 'sudo ros config validate -i wtf.yml'?
Also, I'm assuming you have your case sensitivity down with respect to your paths?
Hard to tell. Anything coming up in the logs?