Andrew,
Thanks for the response. I figured it out in the meantime. I’ll copy what I wrote in the pcaspy issue I opened (https://github.com/paulscherrerinstitute/pcaspy/issues/38) just in case someone stumbles upon it here:
I found a fix which involves changing the broadcast address of the interface in the container from 0.0.0.0 to the correct broadcast address of 224.0.55.55 using ifconfig. I am still not sure why the broadcast address is initially set to 0.0.0.0. I'm also not sure why the broadcast address that works is 224.0.55.55. Maybe that is apparent to someone with more knowledge. I found that address in this docker issue docker/docker#3043 in a comment by rhasselbaum where he shows how to use iperf to do multicast between containers.
Anyway, for a debian container you can run pcaspy like so:
On host:
# start the container you want to run the server in
# NET_ADMIN capabilities are needed to set the broadcast address
docker run --name=my_server -it --cap-add=NET_ADMIN Your/Epics-Image /bin/bash
# start a container to be the client
docker run --link=my_server -it Your/Epics-Image /bin/bash
In server container:
# get ifconfig
apt install net-tools
# set the broadcast address for the network
ifconfig eth0 broadcast 224.0.55.55
# start caRepeater (to warning messages)
caRepeater &
# run your pcaspy server. Let's pretend it serves the PV Docker:Test
python your_pcaspy_server.py
In client container:
export EPICS_CA_ADDR_LIST="my_server"
caget Docker:Test
But the reasons it wasn't working are
0.0.0.0 is not the real broadcast address for the network.
cas explicitly rejects the 0.0.0.0 address when it is vetting the interfaces, so it wouldn't make it through even if it was right.
Anyway, hopefully this will help someone trying to do this in the future.
Thanks
John
On 3/30/17, 4:08 PM, "Andrew Johnson" <[email protected]> wrote:
Hi John,
Do you know which version of the Base libraries you are using, both for
pcasPy and for the soft IOC? I know we made some changes to the network
interface code recently, and you might find that if you can get pcasPy
to use the latest Base-3.15.5 versions of the libraries the behaviour
might be different. I can't promise it will fix it, but it would be
helpful to know.
One thing I did notice in your ifconfig output, the broadcast inet
address for your container has not been set; configuring that might make
a difference (it's worth trying at least).
- Andrew
On 03/30/2017 11:58 AM, Sparger, John E. wrote:
> Hi,
>
>
>
> If I try to run pcaspy in docker, I get the following error in CAS:
>
>
>
> ```
>
> filename="../../../../src/cas/io/bsdSocket/casDGIntfIO.cc" line number=121
>
> server isnt attached to a network - unable to continue
>
> filename="../../../../src/cas/io/bsdSocket/caServerIO.cc" line number=116
>
> Attempt to set server's IP address/port failed unable to attach explicit
> interface
>
> filename="../../../../src/cas/generic/caServerI.cc" line number=59
>
> server isnt attached to a network - CA server internals init unable to
> continue
>
> terminate called after throwing an instance of 'int'
>
> ```
>
>
>
> I understand that this has something to do with CAS's interface
> detection. However, if I run `softIOC` with the following db
>
>
>
> ```
>
> echo "record(ai,"test_pv") {
>
> field(VAL,"3")
>
> }" > test.db
>
>
>
> softIOC -d test.db
>
> ```
>
>
>
> It works fine and I can `caget testpv` from another container without
> issue. This leads me to believe that the plumbing is there but that
> there is some assumption made in how CAS detects broadcast interfaces
> that is not holding true in docker.
>
>
>
> Have you all been able to successfully run pcaspy or cas-based servers
> in docker? Are there some environment variables I can set to help cas along?
>
>
>
> I should note that setting `EPICS_CAS_INTF_ADDR_LIST="localhost"` WILL
> allow pcaspy will run in docker, but then the PVs are not visible
> outside that docker container, so it's not that useful.
>
>
>
> Also for reference, here is what ifconfig returns from inside the container:
>
>
>
> ```
>
> ifconfig
>
> eth0 Link encap:Ethernet HWaddr 02:42:ac:11:00:02
>
> inet addr:172.17.0.2 Bcast:0.0.0.0 Mask:255.255.0.0
>
> inet6 addr: fe80::42:acff:fe11:2/64 Scope:Link
>
> UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
>
> RX packets:237 errors:0 dropped:0 overruns:0 frame:0
>
> TX packets:186 errors:0 dropped:0 overruns:0 carrier:0
>
> collisions:0 txqueuelen:0
>
> RX bytes:240235 (234.6 KiB) TX bytes:11013 (10.7 KiB)
>
>
>
> lo Link encap:Local Loopback
>
> inet addr:127.0.0.1 Mask:255.0.0.0
>
> inet6 addr: ::1/128 Scope:Host
>
> UP LOOPBACK RUNNING MTU:65536 Metric:1
>
> RX packets:3 errors:0 dropped:0 overruns:0 frame:0
>
> TX packets:3 errors:0 dropped:0 overruns:0 carrier:0
>
> collisions:0 txqueuelen:1
>
> RX bytes:208 (208.0 B) TX bytes:208 (208.0 B)
>
> ```
>
>
>
> Thanks for the help,
>
>
>
> John Sparger
>
--
Arguing for surveillance because you have nothing to hide is no
different than making the claim, "I don't care about freedom of
speech because I have nothing to say." -- Edward Snowdon
- References:
- PCAS (using pcaspy) in docker ""server isnt attached to a network" Sparger, John E.
- Re: PCAS (using pcaspy) in docker ""server isnt attached to a network" Andrew Johnson
- Navigate by Date:
- Prev:
TcIoc tyse_ljw
- Next:
Reset integral pv and store it Miguel
- 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: PCAS (using pcaspy) in docker ""server isnt attached to a network" Andrew Johnson
- Next:
TcIoc tyse_ljw
- 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
|