Commit Graph

65 Commits

Author SHA1 Message Date
Justin Cormack
3208cca326 go fmt
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2016-10-21 15:35:10 +01:00
Justin Cormack
d435d5115b Update to Go 1.7.3
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2016-10-20 13:17:16 +01:00
Justin Cormack
db0376cb88 add git to Go build package
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2016-10-16 13:49:28 +01:00
Justin Cormack
cfbdc7d067 do not remove build containers
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2016-10-11 16:12:40 +01:00
Justin Cormack
0ac6beff82 Do not create latest tags for base images
As we never use these, do not create them.

Also update images where applicable.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2016-10-10 14:55:48 +01:00
Justin Cormack
fa19d3259b Use build container id rather than tagging builds
This means that multiple builds will not conflict, so we can
remove the lock from the CI. Also quieter when no errors.

Some still left to do, only done the ones used in build and CI
initially. Some of the others will be cleaned up anyway later.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2016-09-29 20:21:17 +01:00
Justin Cormack
206dfe0950 simplify vendor tar
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2016-09-12 16:36:01 +01:00
Justin Cormack
43ab6520cf update to latest alpine base images
Signed-off-by: Justin Cormack <justin@specialbusservice.com>
2016-09-12 16:02:07 +01:00
Justin Cormack
5c634808df simplify tar for vendor directory
Signed-off-by: Justin Cormack <justin@specialbusservice.com>
2016-09-12 16:02:07 +01:00
Justin Cormack
276157a769 Move all output to the directories it will be in eventually
Signed-off-by: Justin Cormack <justin@specialbusservice.com>
2016-09-12 16:02:07 +01:00
Justin Cormack
d00ed9ce6e run with no network
Signed-off-by: Justin Cormack <justin@specialbusservice.com>
2016-09-12 15:59:19 +01:00
Justin Cormack
effff65ecd simplify Dockerfile
Signed-off-by: Justin Cormack <justin@specialbusservice.com>
2016-09-12 15:59:19 +01:00
Justin Cormack
d0c3e873f6 Do not need to use logrus, not using any features of it here.
Signed-off-by: Justin Cormack <justin@specialbusservice.com>
2016-09-12 15:59:19 +01:00
Justin Cormack
28afc72a97 move vendor directory directly under packages
Signed-off-by: Justin Cormack <justin@specialbusservice.com>
2016-09-12 15:59:19 +01:00
Justin Cormack
b69893eb6d Clean up proxy Makefile
Model for the others, make sure dependencies are correct and that
only the exactly correct things are passed to Docker. No longer copy
vendor directory.

Signed-off-by: Justin Cormack <justin@specialbusservice.com>
2016-09-12 15:59:19 +01:00
Justin Cormack
089c592873 Include the Go binary in the hash of the go build base
As this is not installed via apk it was not being included in the
checksum.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2016-09-09 15:46:23 +01:00
David Scott
c6757075d0 proxy: don't fail if the Listen in the VM fails with EADDRNOTAVAIL
The purpose of the `slirp-proxy` is to expose ports on the Mac or
Windows host. In d5bd7d690a we added
an additional `Listen` inside the VM for backwards compatibility
with software that expected to be able to listen on `0.0.0.0` in
one container and then access this easily from other containers
using an IP bound to the VM (instead of using a first-class network
to connect the containers or discovering a real IP of the host).

Before this patch we could only expose ports on if the Listen
succeeds on both the host and the VM. In practice this meant that
we could only expose ports on `0.0.0.0` and `127.0.0.1`; attempts
to expose ports on specific interfaces on the host would fail.

This patch treats the EADDRNOTAVAIL error from the Listen inside
the VM as a soft failure, and still attempts to Listen on the host.
If the Listen on the host fails it is still a hard failure.
This allows ports to be exposed on specific IPs used on the host.

Fixes [docker/pinata#5080]

Signed-off-by: David Scott <dave.scott@docker.com>
2016-09-08 13:32:25 +01:00
Justin Cormack
d4b5fc07c9 Closer to reproducible builds
Make an alpine base image for C and Go builds.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2016-09-06 13:18:11 +01:00
Justin Cormack
30d4cf9675 more specific golang alpine base package
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2016-09-05 15:05:52 +01:00
Justin Cormack
487307a551 use platform not vmbus consistently
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2016-07-20 12:07:40 +01:00
Justin Cormack
67b2a00853 Add conditional services based on mobyplatform
Replaces https://github.com/docker/moby/pull/282

Use mobyplatform=xxx to specify platform in boot command

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2016-07-18 12:39:14 +01:00
David Scott
3c6ad76461 proxy: add a -no-local-ip option
docker itself seems to bind to the port globally inside Moby, so we
get an EADDRINUSE if we try to do it too.

Signed-off-by: David Scott <dave.scott@docker.com>
2016-07-12 10:26:42 +01:00
David Scott
32ee88c347 proxy-vsockd: bump the max number of file descriptors
Signed-off-by: David Scott <dave.scott@docker.com>
2016-07-04 21:49:17 +01:00
David Scott
839f53d9b1 proxy: add interactive mode with -i
This allows the proxy to be run easily from a terminal or other script
without requiring fd 3 to be open and writable.

Signed-off-by: David Scott <dave.scott@docker.com>
2016-06-17 11:11:10 +01:00
Justin Cormack
dd5fe0455b Update to docker 1.12-dev plus proxy patches, close to what will be rc1
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2016-06-14 14:13:36 +01:00
Rolf Neugebauer
a9fa07fd73 proxy: fix handling of CloseRead/CloseWrite for TCP port proxy
Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2016-06-10 16:05:14 +01:00
Ian Campbell
5165a6c795 Add || true to the docker rmi invocations in the clean target
Linux xargs calls the command with no arguments if it gets no inputs, which
`docker rmi` complains about. It provides -r / --no-run-if-empty to prevent
this but unfortunately this isn't supported on OSX.

Ignore errors from `docker rmi` so that `make clean` will keep going and clean
up later stuff.

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2016-06-08 13:59:47 +01:00
David Scott
a6a1c4b1a6 proxy: remove the dynamic vsock port allocation
On both Mac and Windows we have one well-known port and a SOCKS-like
port to tunnel connections through it. This was necessary on Windows
where ports have well-known GUIDs, but we might as well do it the same
way on both platforms for consistency.

This patch removes the dynamic binding of vsock ports, which fails on
a Windows Moby anyway.

Signed-off-by: David Scott <dave.scott@docker.com>
2016-05-26 17:01:27 +01:00
David Scott
b921ae7c36 On Hyper-V, mount the /port filesystem
This allows localhost port forwards to be requested if

  native/port-forwarding=true

if set.

Signed-off-by: David Scott <dave.scott@docker.com>
2016-05-22 18:43:07 +01:00
David Scott
d46052773d proxy: update the 9P protocol
We now tell the 9P server

 proto1:ip1:port1:<address for forwarding>

which means please listen on proto1:ip1:port1, then connect to the port
proxy in Moby and tell it the connection is for <address for forwarding>.

Note this requires a corresponding change in hostnet/vpnkit.

Signed-off-by: David Scott <dave.scott@docker.com>
2016-05-22 12:43:24 +01:00
David Scott
980588b68f proxy: add a multiplexing server frontend
On a Hyper-V system we can only register one listening endpoint (with
a GUID), so we need to accept connections, read a header and then
start the proxy.

If the binary has argv[0] == "proxy-vsockd" then run this new frontend.

Signed-off-by: David Scott <dave.scott@docker.com>
2016-05-22 12:43:18 +01:00
Rolf Neugebauer
8a15616f33 proxy: use share vendored go packages
Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2016-05-19 13:54:48 +01:00
Justin Cormack
a740d022ff use build-base not alpine-sdk as smaller
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2016-05-17 10:00:58 -05:00
David Scott
198dc8ba73 proxy: bind the IP port as well as the vsock port
Previously the proxy would listen only on the vsock port, which is
fine for accessing the port on the host, but if a container also wants
to access the port (e.g. via `--net=host` and using the Moby IP) then
we need to listen on the IP too.

Related to [docker/pinata#2854]

Signed-off-by: David Scott <dave.scott@docker.com>
2016-04-29 13:53:02 +01:00
David Scott
5dee7f7bfd proxy: fix gofmt violations
Signed-off-by: David Scott <dave.scott@docker.com>
2016-04-22 16:10:36 +01:00
David Scott
610dac2fb7 proxy: fix the marshalling of the UDP frames
- the initial length field should be the total length of the whole
  frame including the variable length field and including the length
  field
- when unmarshalling, return the number of bytes of payload actually
  unmarshalled and not the size of the unmarshal buffer

Signed-off-by: David Scott <dave.scott@docker.com>
2016-04-22 15:35:21 +01:00
David Scott
e940e12abc proxy: listen on vsock before requesting a connection
The 9P operations tell the host to connect to the vsock port in the
UDP case, so always listen before sending the 9P request.

Signed-off-by: David Scott <dave.scott@docker.com>
2016-04-22 15:32:22 +01:00
David Scott
caeb0d53cc proxy: add an initial length to the marshalled frames
Since the header is variable length it's useful to write a length
field first, so the peer can read the rest of the packet as a block.

Signed-off-by: David Scott <dave.scott@docker.com>
2016-04-22 11:42:24 +01:00
David Scott
03ea441933 proxy: implement the UDP marshalling/unmarshalling
Signed-off-by: David Scott <dave.scott@docker.com>
2016-04-21 16:52:31 +01:00
David Scott
3870705eaf proxy: prepare to encapsulate UDP datagrams over a vsock connection
A net.UDPListener is the datagram equivalent of a net.Conn. This patch
accepts at most one connection from vsock and attempts to read and write
UDP datagrams along it.

Signed-off-by: David Scott <dave.scott@docker.com>
2016-04-21 16:26:28 +01:00
David Scott
abbafd82f1 proxy: create a udpListener interface
This represents what is needed from the frontend side of the proxy:

- the ability to receive a UDP datagram and know who it is from
- the ability to send a UDP datagram to a particular destination
- the ability to close

Signed-off-by: David Scott <dave.scott@docker.com>
2016-04-21 15:06:09 +01:00
David Scott
58ad1b7161 proxy: map TCP ports at 0x10000-0x20000, and UDP at 0x20000-
The proxy process command-line arguments assume we're exposing TCP
or UDP ports on Moby's public IPs. Instead we're forwarding over vsock
where we must map the Moby ports onto vsock ports. Normally TCP and
UDP ports are different, but with vsock there is only one space of
port numbers so we have to map them into different ranges.

This patch maps Moby ports as follows:

- TCP port x onto vsock port 0x10000 + x
- UDP port x onto vsock port 0x20000 + x

Signed-off-by: David Scott <dave.scott@docker.com>
2016-04-21 14:45:55 +01:00
David Scott
b3f82f045a proxy: vendor github.com/djs55/vsock
Signed-off-by: David Scott <dave.scott@docker.com>
2016-04-15 17:43:10 +01:00
David Scott
9100625204 proxy: move vendor/libproxy to ./libproxy
vendor should be used for things with fully-qualified names,

Signed-off-by: David Scott <dave.scott@docker.com>
2016-04-15 17:29:23 +01:00
David Scott
a48307b5e7 proxy: calling Close() on the Accept()ing fd won't cause it to return
This seems to be a difference between the AF_VSOCK and AF_INET
implementations. We work around it by exiting the proxy process
immediately, which will clean up resources anyway.

Signed-off-by: David Scott <dave.scott@docker.com>
2016-04-15 17:24:56 +01:00
David Scott
586d9c0598 proxy: fix up the vsock interface
- don't try to create a `FileConn` because the Go library sees through
  the scam and rejects it
- explicitly keep a reference to the `ctl` file just in case the GC
  decides its dead and should be closed.

Signed-off-by: David Scott <dave.scott@docker.com>
2016-04-15 17:24:56 +01:00
David Scott
1d3b8b566e proxy: tell the /port server the real external IP address
Before this we accidentally told it the vsock address, which obviously
isn't much good.

Signed-off-by: David Scott <dave.scott@docker.com>
2016-04-15 17:24:56 +01:00
David Scott
b0c4fdae37 proxy: we don't need to explicitly unexposePort any more
The port will be automatically removed when the fd/fid is closed by
a process exit/crash, or by a hypervisor crash.

Signed-off-by: David Scott <dave.scott@docker.com>
2016-04-15 17:24:56 +01:00
David Scott
e4f405be26 proxy: request a vsock connection rather than a TCP/IP one
Note this means we don't need to figure out our local IP address.

Signed-off-by: David Scott <dave.scott@docker.com>
2016-04-15 17:24:56 +01:00
David Scott
403ce4e696 proxy: libproxy: add a case for VsockAddr types
The `NewProxy` function already knows how to deal with `net.UDPAddr`
and `net.TCPAddr`, this patch adds similar support for `vsock.VsockAddr`.

Signed-off-by: David Scott <dave.scott@docker.com>
2016-04-15 17:24:56 +01:00