Commit Graph

540 Commits

Author SHA1 Message Date
Ian Campbell
be7a9a4cda vsudd: New daemon to proxy vsock to Unix domain sock
Used to proxy vsock 2376 <-> /var/run/docker.sock in the Moby VM.

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2016-04-05 13:50:06 +01:00
Ian Campbell
4b1936db47 nc-vsock: Add unidirecitonal read/write modes
-r == read from the vsock
-w == write to the vsock

This makes it easier to write automated test cases.

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2016-04-05 13:40:41 +01:00
Ian Campbell
778b82a0de nc-vsock: shutdown output socket on input EOF
Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2016-04-05 13:40:41 +01:00
Ian Campbell
2bfd4e62c8 nc-vsock: Keep going until both fds read EOF.
Rather than exiting when the first read hits EOF, ignoring any remaining data
going the other way.

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2016-04-05 13:40:41 +01:00
Ian Campbell
2e70f27c79 nc-vsock: output to stdout rather than stdin
Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2016-04-05 13:40:41 +01:00
Ian Campbell
3d7da9df67 nc-vsock: Use a 256K buffer
Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2016-04-05 13:40:41 +01:00
Ian Campbell
a887fb110c Add VSOCK patches
These are WIP taken from git@github.com:stefanha/linux.git#vsock
(==4c9d2a6be1c6, using "cherry-pick -x") and correspond to RFC v5 of the
frontend patches posted in
http://thread.gmane.org/gmane.linux.kernel.virtualization/27455

There is no corresponding spec proposal update yet, but this set of patches
correspond (roughly) to addressing the feedback on v4 of the spec proposal
http://thread.gmane.org/gmane.comp.emulators.virtio.devel/1062.

kernel_config.arm modifications copied from x86, not tested.

Added /etc/kernel-patches/ directory to the image to be consumed by the
licensing.

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2016-04-05 13:40:36 +01:00
Ian Campbell
f065ec7fdb Add nc-vsock utility (for testing AF_VSOCK)
Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2016-04-05 13:39:44 +01:00
Justin Cormack
22464eae51 fix licensing container to fix #70
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2016-04-05 12:40:26 +01:00
Justin Cormack
2668e441d5 remove 9p mounts for lofs and sockets
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2016-04-05 11:22:39 +01:00
Justin Cormack
09a98bf3e2 remove 9pudc, unused and not being fixed
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2016-04-04 18:21:01 +01:00
Justin Cormack
a65b7eff5a Do not pin alpine 3.3 version, we do apk upgrade anyway
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2016-04-04 15:56:51 +01:00
Justin Cormack
88b70e87c3 Merge pull request #66 from djs55/docker-proxy-ports
Add custom docker-proxy which understands host port forwarding
2016-04-04 16:32:11 +02:00
Justin Cormack
d0dee08049 Merge pull request #68 from justincormack/linux4.4
update to 4.4.6 stable kernel series
2016-04-04 15:13:09 +02:00
Justin Cormack
8220f615f0 update to 4.4.6 stable kernel series
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2016-04-04 14:04:55 +01:00
David Scott
c139fe3585 Import docker/docker/pkg/proxy from 18c7c67308bd4a24a41028e63c2603bb74eac85e
Signed-off-by: David Scott <dave.scott@docker.com>
2016-04-04 12:41:45 +01:00
David Scott
edcf29c5e4 docker: if network=slirp or native/port-forwarding=true, forward ports
Signed-off-by: David Scott <dave.scott@docker.com>
2016-04-04 12:41:45 +01:00
David Scott
8716bbde2c 9pinit: mount the port control filesystem under /port
This filesystem can be used to add and remove host port forwards e.g.

  mkdir /port/test
  echo -n '127.0.0.1:80:127.0.0.1:80' >> /port/test/ctl
  RESULT=$(cat /port/test/ctl)

Signed-off-by: David Scott <dave.scott@docker.com>
2016-04-04 12:41:45 +01:00
David Scott
1d66615bc4 docker: add a patch to add --userland-proxy-bin argument
This will let us override the `docker-proxy` with the enhanced host
port-forwarding aware version.

Signed-off-by: David Scott <dave.scott@docker.com>
2016-04-04 12:41:45 +01:00
David Scott
96dd99326f docker: compile from scratch rather than download binaries
A later patch will apply a non-upstream patch to docker.

Signed-off-by: David Scott <dave.scott@docker.com>
2016-04-04 12:41:45 +01:00
David Scott
9acc04f99b proxy: determine "my" address by examining the "docker" forward
When requesting a port forward we currently need to know the VM's
address from the point of view of the port forwarder. The easiest way to
discover this is to read it from the existing "docker" port forward.

Note this should all be revamped once we have vsock support.

Signed-off-by: David Scott <dave.scott@docker.com>
2016-04-04 12:41:02 +01:00
David Scott
e8fa5ace35 proxy: set up and tear down host port forwards
This patch uses the /port 9P filesystem to set up and tear down port
forwards on the host.

Signed-off-by: David Scott <dave.scott@docker.com>
2016-04-04 12:41:02 +01:00
David Scott
00ff8897a7 proxy: add exposePort and unexposePort stubs
This patch removes `proxyForever` and adds `sendError` and `sendOK` for
signalling to the parent process. The main function now sequences these
functions and calls stub functions `exposePort` and `unexposePort` which
will be hooked up in a later patch.

Signed-off-by: David Scott <dave.scott@docker.com>
2016-04-04 12:41:02 +01:00
David Scott
a8fc95eb9d proxy: on exit, return to main for cleanup
Previously the proxy.go would directly call `os.Exit`. This patch
causes control to return to `main` where we can tear down any port
forward.

Signed-off-by: David Scott <dave.scott@docker.com>
2016-04-04 12:41:02 +01:00
David Scott
444a6147d9 proxy: split the execProxy function into parts
Previously `execProxy` would
- create the proxy
- signal success/failure to the parent
- run forever (until signalled)

Since we want to add more proxy setup and teardown, this patch
removes the proxy creation from `execProxy` and renames it to
`proxyForever`. Later patches will be able to perform the necessary
side-effects before signalling success to the parent.

Signed-off-by: David Scott <dave.scott@docker.com>
2016-04-04 12:41:02 +01:00
David Scott
e1b8975016 Import docker/libnetwork/portmapper/proxy.go
Signed-off-by: David Scott <dave.scott@docker.com>
2016-04-04 12:41:02 +01:00
David Scott
dc9b79f116 Add skeleton /sbin/proxy program
This will eventually contain the `docker-proxy` replacement.

Signed-off-by: David Scott <dave.scott@docker.com>
2016-04-04 12:41:02 +01:00
Justin Cormack
f4a21e4d1f make tar more correct, by defining z
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2016-04-04 12:20:18 +01:00
Justin Cormack
b58f06212d fix typo in tar extract
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2016-04-04 12:13:45 +01:00
Justin Cormack
4b0c50a779 Remove docker-x for now as no longer working, and was not possible to enable. Will rework when strategy for supporting multiple dockers decided
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2016-04-04 11:47:48 +01:00
Justin Cormack
249151a445 Increase p and n ulimits to match boot2docker, fixes #64
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2016-04-04 11:44:27 +01:00
Justin Cormack
fac0264ecf clean up unpacking docker rc3 bundle
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2016-04-03 09:34:01 +01:00
Justin Cormack
89c6c66c19 Merge pull request #63 from djs55/diagnostics-server
Make the diagnostics download more reliable
2016-04-02 22:34:15 +01:00
David Scott
48a3916095 diagnostics: apply a timeout to all commands
This should avoid unnecessary blocking if (for example) the network is
down.

Signed-off-by: David Scott <dave.scott@docker.com>
2016-04-02 13:55:36 +01:00
David Scott
911a1e2bd7 diagnostics: run iptables-save
This is more complete than `iptables -t nat -L`

Signed-off-by: David Scott <dave.scott@docker.com>
2016-04-02 13:55:36 +01:00
Justin Cormack
1e0778657c update to docker 1.11.0-rc3
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2016-04-02 09:12:20 +01:00
Justin Cormack
e891d65e97 Support for 1.11.0-rc2, fix #57
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2016-03-31 18:54:05 +01:00
Justin Cormack
5551e60fd1 check diagnostics server running in diagnostics
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2016-03-31 14:58:13 +01:00
Justin Cormack
ad8e6c39e7 Merge pull request #59 from djs55/diagnostics-server
Allow diagnostics to be downloaded on port 62374
2016-03-31 12:16:00 +01:00
David Scott
a163c06ba0 diagnose: include iptables -t nat -L
The extra `-t nat` includes the masquerading stuff.

Signed-off-by: David Scott <dave.scott@docker.com>
2016-03-31 11:14:31 +01:00
David Scott
b10af0dc92 diagnostics: use netstat -tulpn which includes process names
For example:

  docker:~# netstat -tulpn
  Active Internet connections (only servers)
  Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
  tcp        0      0 :::32768                :::*                    LISTEN      1344/docker-proxy
  tcp        0      0 :::2375                 :::*                    LISTEN      1124/docker
  tcp        0      0 :::5000                 :::*                    LISTEN      1444/docker-proxy
  tcp        0      0 :::5001                 :::*                    LISTEN      1494/docker-proxy

Signed-off-by: David Scott <dave.scott@docker.com>
2016-03-31 10:35:35 +01:00
Justin Cormack
e5c3789caa update to 4.1.20
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2016-03-30 17:02:22 +01:00
David Scott
5a4cc0a779 diagnose: grab the tail /var/log/docker.log
Signed-off-by: David Scott <dave.scott@docker.com>
2016-03-30 15:42:48 +01:00
Justin Cormack
7cb194459b simplified vendoring
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2016-03-30 15:08:32 +01:00
David Scott
673b44cf95 diagnose: put all the files inside a moby/ subdirectory
Signed-off-by: David Scott <dave@recoil.org>
2016-03-30 15:03:28 +01:00
David Scott
2461710f7d diagnose: ls -l /var, /var/lib and /var/lib/docker
Signed-off-by: David Scott <dave.scott@docker.com>
2016-03-30 14:28:00 +01:00
David Scott
4bd38ce8bf diagnose: try a ping, grab /etc/resolv.conf and route -n
Signed-off-by: David Scott <dave.scott@docker.com>
2016-03-30 14:25:58 +01:00
David Scott
d402a579f5 diagnostics-server: add more diagnostics
For networking:
- ifconfig -a
- brctl show

For storage:
- mount
- df

Signed-off-by: David Scott <dave@recoil.org>
2016-03-30 10:34:04 +01:00
David Scott
d842e1b5dc Allow diagnostics to be downloaded on port 62374
A client like `pinata diagnose` can do the equivalent of:

  nc 192.168.64.2 62374 > foo.tar

and find `foo.tar` contains

- the output of `/usr/bin/diagnostics`
- `iptables -L`
- `netstat -an`
- `ps uax`
- `docker ps`
- `dig docker.com`
- `wget http://docker.com`

This will allow us to diagnose various in-VM faults, without having
to ask the user to access the console and run commands.

Signed-off-by: David Scott <dave.scott@docker.com>
2016-03-30 10:31:55 +01:00
Justin Cormack
6d890f007b switch root to a tmpfs filesystem, so pivot_root works, should make #57 work now
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2016-03-29 22:09:23 +01:00