Solved Docker container fix IP ?

Currently reading
Solved Docker container fix IP ?

10
1
NAS
Synology DS218+
Operating system
  1. Windows
Mobile operating system
  1. Android
Hi,
quick question :

I've linked a Firefly-docker with a MariaDB-docker using docker internal network (172.17.0.X). However each time I restart the NAS, the containers become different IPs and I have to manually change them in the environment variables. I know there is a possibility with bridges but I don't really understand how to set them up.

Would someone be kind enough to help me ? :)
Thanks in advance
 

fredbert

Moderator
NAS Support
Subscriber
1,700
692
NAS
DS1520+, DS218+, DS215j
Router
  1. RT2600ac
  2. MR2200ac
Operating system
  1. macOS
Mobile operating system
  1. iOS
When I set up FreshRSS with PostgreSQL I used a link in the FreshRSS configuration that provided and alias to the PostgreSQL container. The alias is used by FreshRSS to refer to whatever IP is currently assigned to PostgreSQL.

See sections 'Add the FreshRSS container to Docker' and 'Configuring FreshRSS' for how the link is setup and used. Probably similar for you?
 
10
1
NAS
Synology DS218+
Operating system
  1. Windows
Mobile operating system
  1. Android
Thank you for your answer, fredbert.

But doesn't that require a specific formulation dependent on the client container (FreshRSS in your case) ? I don't see anything similar for Firefly.
 

fredbert

Moderator
NAS Support
Subscriber
1,700
692
NAS
DS1520+, DS218+, DS215j
Router
  1. RT2600ac
  2. MR2200ac
Operating system
  1. macOS
Mobile operating system
  1. iOS
AFAIK the link adds an entry to /etc/hosts that gets updated by Docker so that the current linked container's IP is associated with the alias.

If I issue the command ping rss_psql_server from within a FreshRSS console then it will resolve to the current IP and ping it.

Edit: Adding a link is one of the tabs in Synology Docker's Edit window, or in the Advanced settings when creating a new container.
 
10
1
NAS
Synology DS218+
Operating system
  1. Windows
Mobile operating system
  1. Android
Ahhh I understand.
I made a link with mariadb from firefly-docker, used that alias as IP in the environment variables and it worked ! Now I will test it with a restart.
Thanks a lot for your help
 

Shadow

Subscriber
568
188
NAS
DS216+II, DS118, DS718+
Router
  1. RT2600ac
  2. MR2200ac
Operating system
  1. Windows
Mobile operating system
  1. Android
docker network connect --ip <desired ip> <docket network name> <docker container name>
 
10
1
NAS
Synology DS218+
Operating system
  1. Windows
Mobile operating system
  1. Android
Thank you Shadow.

The bridge solution was however enough for my problem :)
 

Create an account or login to comment

You must be a member in order to leave a comment

Create account

Create an account on our community. It's easy!

Log in

Already have an account? Log in here.

Welcome to SynoForum.com!

SynoForum.com is an unofficial Synology forum for NAS owners and enthusiasts.

Registration is free, easy and fast!

Similar threads

Similar threads

Top