Docker + Base.runtests("Sockets")


How can I run Julia “Sockets” test inside docker environments?

I tried & finished with errors :frowning:

  • docker run -it --rm julia:1.0.3 julia -e 'Base.runtests("Sockets")'
  • docker run --privileged -it --rm julia:1.0.3 julia -e 'Base.runtests("Sockets")'
  • docker run --net=host -it --rm julia:1.0.3 julia -e 'Base.runtests("Sockets")'

My environment:

Added later:

:julia: SOLUTION: You need to enable IPv6 support in the Docker daemon AND --fixed-cidr-v6 must be provided.


Can you show the errors you’re getting? It’s probably just a bad assumption in Sockets’ tests, or a misconfiguration of your docker networking setup.


docker run -it --rm julia:1.0.3 julia -e 'Base.runtests("Sockets")'

Error in testset Sockets:
Error During Test at /usr/local/julia/share/julia/stdlib/v1.0/Sockets/test/runtests.jl:228
  Got exception outside of a @test
  IOError: UDP send failed: address not available (EADDRNOTAVAIL)
   [1] try_yieldto(::typeof(Base.ensure_rescheduled), ::Base.RefValue{Task}) at ./event.jl:196
   [2] wait() at ./event.jl:255
   [3] wait(::Condition) at ./event.jl:46
   [4] stream_wait(::UDPSocket, ::Condition) at ./stream.jl:47
   [5] send(::UDPSocket, ::IPv6, ::UInt16, ::String) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Sockets/src/Sockets.jl:355
   [6] macro expansion at /usr/local/julia/share/julia/stdlib/v1.0/Sockets/test/runtests.jl:277 [inlined]
   [7] macro expansion at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Test/src/Test.jl:1083 [inlined]
   [8] top-level scope at /usr/local/julia/share/julia/stdlib/v1.0/Sockets/test/runtests.jl:230
   [9] include at ./boot.jl:317 [inlined]
   [10] include_relative(::Module, ::String) at ./loading.jl:1044

full LOGS:

On dev1 ( Ubuntu 18.04 + Docker 18.09.0 linux/amd64 ):

On Cloud : Ubuntu 18.10 + Docker 18.09.0


Ok, this helps. What it looks like is that your container does not have an IPv6 loopback address configured (::1 specifically). Hence, you get an EADDRNOTAVAIL error since the tests try to send to this address, which is almost always available outside of a container, including within VMs (hence why tests pass on CI). Try getting this to run within your container:

ip -6 addr

When I run this on my baremetal host, I get the following:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 state UNKNOWN qlen 1000
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever


Thank you! You are right ! :sunny:

What I have learned:

  • The Docker IPv6 support - is not enabled with the default install
    • To enable I did :
      • "Before you can use IPv6 in Docker containers or swarm services, you need to enable IPv6 support in the Docker daemon. "
      • “Note: IPv6 networking is only supported on Docker daemons running on Linux hosts.”
        • "Edit /etc/docker/daemon.json and set the ipv6 key to true"
        • "Reload the Docker configuration file. : systemctl reload docker"
      • –fixed-cidr-v6 must be provided! ( search for " docker ipv6 fixed-cidr-v6" via Google )
  • Now running the : docker run -it --rm julia:1.0.3 ip -6 addr is still no output.
  • But the Base.runtest("Sockets") is OK
    :sunny: :sunny: :sunny: :sunny: :sunny: :sunny:
#docker run -it --rm julia:1.0.3 ip -6 addr 
#docker run -it --rm julia:1.0.3 ip -6 addr && julia -e 'Base.runtests("Sockets")'
Test  (Worker) | Time (s) | GC (s) | GC % | Alloc (MB) | RSS (MB)
Sockets    (1) |     6.30 |   0.08 |  1.3 |     302.95 |   238.89

Test Summary: | Pass  Total
  Overall     |  141    141