# Docker + Base.runtests("Sockets")

**URL:** <https://discourse.julialang.org/t/docker-base-runtests-sockets/19435>\
**Category:** New to Julia\
**Created:** [January 9, 2019, 3:56pm UTC](https://discourse.julialang.org/t/docker-base-runtests-sockets/19435 "2019-01-09T15:56:44Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ImreSamu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/imresamu/32/20677_2.png) [@ImreSamu](https://discourse.julialang.org/u/ImreSamu)\
**Post date:** [January 9, 2019, 3:56pm UTC](https://discourse.julialang.org/t/docker-base-runtests-sockets/19435/1 "2019-01-09T15:56:44Z")

</div>

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

I tried & finished with errors ☹

- `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:

- Ubuntu 18.04.1 LTS
- Docker 18.09.0 linux/amd64
- (docker) official `julia:1.0.3` image ( [GitHub - docker-library/julia: Docker Official Image packaging for julia](https://github.com/docker-library/julia) )

Added later:

:julia: **SOLUTION:** [You need to enable IPv6 support in the Docker daemon](https://docs.docker.com/config/daemon/ipv6/) AND `--fixed-cidr-v6` must be provided.

---

<div class="post-metadata">

**Author:** ![jpsamaroo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jpsamaroo/32/46804_2.png) [@jpsamaroo](https://discourse.julialang.org/u/jpsamaroo)\
**Post date:** [January 9, 2019, 5:45pm UTC](https://discourse.julialang.org/t/docker-base-runtests-sockets/19435/2 "2019-01-09T17:45:54Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ImreSamu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/imresamu/32/20677_2.png) [@ImreSamu](https://discourse.julialang.org/u/ImreSamu)\
**Post date:** [January 9, 2019, 6:16pm UTC](https://discourse.julialang.org/t/docker-base-runtests-sockets/19435/3 "2019-01-09T18:16:47Z")

</div>

> [@jpsamaroo](#):
>
> 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")'`

```julia-auto
...
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)
  Stacktrace:
   [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` ):

- [`docker run -it --rm julia:1.0.3 julia -e 'Base.runtests("Sockets")'` · GitHub](https://gist.github.com/ImreSamu/3523d1ce9e3158193f7fd63d30a389db)

On Cloud : Ubuntu 18.10 + Docker 18.09.0

- [Cloud2 + Ubuntu 18.10 (GNU/Linux 4.18.0-10-generic x86\_64) + Docker 18.09.0 · GitHub](https://gist.github.com/ImreSamu/b8edd9ec87a0d05b8d469db5e1f354f9)

---

<div class="post-metadata">

**Author:** ![jpsamaroo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jpsamaroo/32/46804_2.png) [@jpsamaroo](https://discourse.julialang.org/u/jpsamaroo)\
**Post date:** [January 10, 2019, 3:08pm UTC](https://discourse.julialang.org/t/docker-base-runtests-sockets/19435/4 "2019-01-10T15:08:01Z")

</div>

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:

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

```

---

<div class="post-metadata">

**Author:** ![ImreSamu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/imresamu/32/20677_2.png) [@ImreSamu](https://discourse.julialang.org/u/ImreSamu)\
**Post date:** [January 10, 2019, 4:16pm UTC](https://discourse.julialang.org/t/docker-base-runtests-sockets/19435/5 "2019-01-10T16:16:15Z")

</div>

> [@jpsamaroo](#):
>
> What it looks like is that your container does not have an IPv6 loopback address configured ( `::1` specifically)

Thank you! You are right ! ☀

What I have learned:

- The Docker IPv6 support - **is not enabled with the default install**
  - To enable I did : [Enable IPv6 support | Docker Docs](https://docs.docker.com/config/daemon/ipv6/)
    - _"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  
☀☀☀☀☀☀

```julia
#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
    SUCCESS

```

EDIT:

- Be careful! No Docker IPv6 NAT : [https://github.com/moby/moby/issues/25407](https://github.com/moby/moby/issues/25407)

---

<div class="post-metadata">

**Author:** ![Vinod\_Kumar\_K](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vinod_kumar_k/32/43551_2.png) [@Vinod\_Kumar\_K](https://discourse.julialang.org/u/Vinod_Kumar_K)\
**Post date:** [October 18, 2022, 12:13pm UTC](https://discourse.julialang.org/t/docker-base-runtests-sockets/19435/6 "2022-10-18T12:13:32Z")

</div>

I’m not able to find daemon.json file in my vm
