Link two containers using rkt?

151 views
Skip to first unread message

Derek Mahar

unread,
Jul 15, 2016, 12:03:46 PM7/15/16
to CoreOS Dev
How do I link two containers by name using 'rkt run', similar to 'docker run --link name:alias'?

Thank you,

Derek

Florian Koch

unread,
Jul 15, 2016, 12:06:02 PM7/15/16
to coreo...@googlegroups.com
Hi,

Use rkt run ContainerA ContainerB

Derek Mahar

unread,
Jul 15, 2016, 12:17:52 PM7/15/16
to CoreOS Dev
Is there another way to do this without running them in the same command?  I have the following scenario which I mentioned in an earlier message:

Service/Container 1: PostgreSQL Server
Service/Container 2: Create database schema in PostgreSQL Server using Liquibase
Service/Container 3: Application that connects to PostgreSQL Server

Liquibase, in Service 2, will restart repeatedly until PostgreSQL is available to accept SQL commands.  Service 3 will start only after Service 2 is complete.

How can I connect these application containers using simple host name networking?

Derek

Derek Mahar

unread,
Jul 15, 2016, 1:58:58 PM7/15/16
to CoreOS Dev
Nevermind.  I just learned that systemd cannot restart a oneshot service on failure, so it can't restart Liquibase repeatedly until the PostgreSQL server is available.  I'll have to find some other way to compose these containers. :(

Alessandro Puccetti

unread,
Jul 16, 2016, 10:24:39 AM7/16/16
to coreo...@googlegroups.com
A quick a dirty way would be wrap the Liquidbase startup command Ina script that check every n seconds if postgre is up and only when it detects it up start Liquidbase. But all of this will be solved soon enough with the new feature.
--

Alessandro Puccetti


Derek Mahar

unread,
Jul 16, 2016, 4:10:08 PM7/16/16
to CoreOS Dev
Yes, this is effectively what I did. I also now launch PostgreSQL and Liquibase in the same pod so that Liquibase can connect to PostgreSQL at the same fixed address (localhost).

Next I need to learn how to make container A in Pod A find and talk to container B in Pod B on the same host. This is turning out to be more difficult than simply linking two containers as one would using Docker Engine.

Derek

Reply all
Reply to author
Forward
0 new messages