Skip to content

Instantly share code, notes, and snippets.

@peteristhegreat
Created November 21, 2019 18:01
Show Gist options
  • Save peteristhegreat/d633832ec987eb47f371a956e7b6e50b to your computer and use it in GitHub Desktop.
Save peteristhegreat/d633832ec987eb47f371a956e7b6e50b to your computer and use it in GitHub Desktop.
Connect Julia from inside Docker to outside
## Start the docker container:
# docker run -dit -p 9009:9009 --name mytest julia:1.0
## Enter the docker container
# docker exec -it mytest bash
using Sockets; l = listen(IPv4(0),9009); accept(l)
## Expected output
# (Blocks until a connection comes thru)
# TCPSocket(RawFD(0x00000014) open, 0 bytes waiting)
using Sockets; connect(9009)
# TCPSocket(RawFD(0x00000016) open, 0 bytes waiting)
## Verify the connection using netstat
# netstat -ac | grep 9009
# netstat -ac | grep tcp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment