EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  <2024 Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  <2024
<== Date ==> <== Thread ==>

Subject: Re: How can I get a PV from an external server from inside a docker container?
From: Carsten Winkler via Tech-talk <tech-talk at aps.anl.gov>
To: "Dale Cox" <cdc05g at acu.edu>, "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov>
Date: Tue, 26 Mar 2024 09:11:05 +0100

Hello Dale, hello Florian,

many thanks for your helpful advises. Now I could solve the issue simply by adding "network_mode: host" to the service "epicsbase".

Now my working docker-compose.yml  looks like:


services:
    epicsbase:
       image: softioc
       container_name: epicsbase
       volumes:
          - ./epicsbase/db:/usr/local/db
       working_dir: /usr/local/epics
       command:
          - /bin/sh
          - -c
          - |
          echo start first Soft IOC
          screen -d -m /usr/local/epics/epics-base/bin/linux-x86_64/softIoc -D /usr/local/epics/epics-base/dbd/softIoc.dbd -d /usr/local/db/test.db
          tail -f /dev/null # keep alive

       network_mode: host


Best regards
Carsten


--------------------Ursprüngliche Nachricht--------------------
Von: Dale Cox <cdc05g at acu.edu>
Gesendet: Montag 25. März 2024 21:14
An: Carsten Winkler <carsten.winkler at helmholtz-berlin.de>
CC: tech-talk at aps.anl.gov
Betreff: Re: How can I get a PV from an external server from inside a docker container?

sorry, this might show up twice.  I replied with the wrong email address.

Hello Carsten,

We run a couple of EPICS services in docker containers at NEXT, so hopefully this is helpful.  I don't think we have any docker IOC's, but we run the archivers dockerized, which use channel access.  If I'm not mistaken - the initial connection when an IOC advertises is done via broadcast.  Docker overlay networks don't pass on broadcast traffic by default.  So we had to find a way to allow that initial handshake to happen.  We created a macvlan network on the docker host, which will pass on broadcasts.

https://docs.docker.com/network/drivers/macvlan/

So after creating the macvlan network shown in the above link, the relevant docker-compose section would reference that network.  You can see that our archive engine has it's own IP address:

---
services:
  archive-engine:
    ...
    networks:
      epics:
        ipv4_address: 10.0.0.2

...

networks:
  epics:
    external: true
    name: epics_macvlan
---

That's what we did anyway, and my archive engine is able to span 2 different networks and talk to iocs, as well as write data to the database on a different network.

Dale

On Mon, Mar 25, 2024 at 8:55 AM Carsten Winkler via Tech-talk <tech-talk at aps.anl.gov> wrote:

Hello,

I have 3 SoftIOCs.
    1.) local host       = 193.100.100.100 with PV: "local_pv"
    2.) external host  = 192.200.200.200 with PV: "external_pv"
    3.) docker container    on local host   with PV: "docker_pv"

From local host I can read all PVs (caget local_pv external_pv docker_pv). 👍
From inside the docker container I can read the local_pv and the docker_pv
but not the external_pv. 🤔

Here is my docker compose configuration:

services:
    epicsbase:
       image: softioc
       container_name: epicsbase
       volumes:
          - ./epicsbase/db:/usr/local/db
       working_dir: /usr/local/epics
       command:
          - /bin/sh
          - -c
          - |
          echo start first Soft IOC
          screen -d -m /usr/local/epics/epics-base/bin/linux-x86_64/softIoc -D /usr/local/epics/epics-base/dbd/softIoc.dbd -d /usr/local/db/test.db
          tail -f /dev/null # keep alive
       networks:
          - ioc-net
networks:
    ioc-net:

From inside the docker container I have also already tried EPICS_CA_AUTO_ADDR_LIST / EPICS_CA_ADDR_LIST. Unfortunately without success.
With and without these environment variables I only get the local_pv and the docker_pv.

How can I also read the external_pv from inside the docker container?

Best regards
Carsten



--
Dale Cox
Instrumentation and Electrical Engineer
ACU NEXT Lab 

Navigate by Date:
Prev: Re: How can I get a PV from an external server from inside a docker container? Florian Feldbauer via Tech-talk
Next: Re: How can I get a PV from an external server from inside a docker container? Carsten Winkler via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  <2024
Navigate by Thread:
Prev: Re: How can I get a PV from an external server from inside a docker container? Érico Nogueira Rolim via Tech-talk
Next: Re: [Ext] Re: Room temperature and humidity monitoring with EPICS? Jesse Hopkins via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  <2024
ANJ, 26 Mar 2024 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·