Commit graph

135 commits

Author SHA1 Message Date
Dan Walsh
497fc8876e Allow IPC namespace to be shared between containers or with the host
Some workloads rely on IPC for communications with other processes.  We
would like to split workloads between two container but still allow them
to communicate though shared IPC.

This patch mimics the --net code to allow --ipc=host to not split off
the IPC Namespace.  ipc=container:CONTAINERID to share ipc between containers

If you share IPC between containers, then you need to make sure SELinux labels
match.

Docker-DCO-1.1-Signed-off-by: Dan Walsh <dwalsh@redhat.com> (github: rhatdan)
2014-11-12 11:29:58 -05:00
Michael Crosby
84f25414c1 Merge pull request #9014 from LK4D4/fix_parent_failing
Not fail on updating parent links
2014-11-10 12:53:16 -08:00
Alexandr Morozov
b83fc07d88 Not fail on updating parent links
Fixes #8796

Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
2014-11-06 15:30:23 -08:00
Michael Crosby
6a6be5bd5a Merge pull request #8983 from LK4D4/consistent_hosts
Consistent hosts
2014-11-06 11:51:28 -08:00
Alexandr Morozov
6cbe1fa726 Make /etc/hosts records consistent
Fixes #8972

Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
2014-11-06 11:36:00 -08:00
Doug Davis
69a5b827dc See #8379 - if the container doesn't start I added code to make sure that if no other processing sets the container.exitCode to a non-zero value when we make sure its done before we return. I also made sure that while trying to start the CMD/ENTRYPOINT, if it fails, then we set the container.exitCode to the exitStatus from the exec().
Closes #8379

Signed-off-by: Doug Davis <dug@us.ibm.com>
2014-11-05 18:23:42 -08:00
Alexandr Morozov
b8678aa7f5 Merge pull request #8946 from unclejack/stream_decode
Decode JSON to avoid ReadFile
2014-11-04 09:02:40 -08:00
Alexandr Morozov
9eb8fcd58a Merge pull request #8390 from MalteJ/set-macaddress
Adding docker-cli run param to set MAC address
2014-11-04 07:54:59 -08:00
unclejack
4bc28f4e6b daemon/container: stream & decode JSON
Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
2014-11-04 16:14:47 +02:00
Malte Janduda
f2df38050e Adding docker-cli run param to set MAC address
Signed-off-by: Malte Janduda <mail@janduda.net>
2014-11-01 15:35:09 +01:00
Jessica Frazelle
e171eda998 fix for iptables cleanup 8307
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-10-29 10:59:20 -07:00
Alexandr Morozov
ee7dd44c01 Mass gofmt
Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
2014-10-24 15:11:48 -07:00
Alexandr Morozov
7c62cee51e Use logrus everywhere for logging
Fixed #8761

Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
2014-10-24 15:03:06 -07:00
Jessie Frazelle
9094c19a6d Merge pull request #8315 from dqminh/save-start-error
Save start error into State.Error when the container fails to start
2014-10-24 13:13:00 -07:00
Srini Brahmaroutu
78a272ce14 Allowing resize tty to only work when container is started
Addresses #8728

Signed-off-by: Srini Brahmaroutu <srbrahma@us.ibm.com>
2014-10-23 21:31:34 +00:00
Daniel, Dao Quang Minh
fb6ee865a9 save start error into State.Error
when a container failed to start, saves the error message into State.Error so
that it can be retrieved when calling `docker inspect` instead of having to
look at the log

Docker-DCO-1.1-Signed-off-by: Daniel, Dao Quang Minh <dqminh89@gmail.com> (github: dqminh)
2014-10-22 22:42:37 -04:00
Brian Goff
ef98fe0763 Make container.Copy support volumes
Fixes #1992

Right now when you `docker cp` a path which is in a volume, the cp
itself works, however you end up getting files that are in the
container's fs rather than the files in the volume (which is not in the
container's fs).
This makes it so when you `docker cp` a path that is in a volume it
follows the volume to the real path on the host.

archive.go has been modified so that when you do `docker cp mydata:/foo
.`, and /foo is the volume, the outputed folder is called "foo" instead
of the volume ID (because we are telling it to tar up
`/var/lib/docker/vfs/dir/<some id>` and not "foo", but the user would be
expecting "foo", not the ID

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2014-10-20 20:23:01 -04:00
Andrea Luzzardi
5b8379a434 Disable stable IPs.
Stable IPs causes some regressions in the way people use Docker, see GH#8493.

Reverting it for 1.3, we'll enable it back for the next release.

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2014-10-09 15:15:17 -07:00
Michael Crosby
4eb812e042 Merge pull request #8457 from jfrazelle/pr_8455
Check /etc/resolv.conf every time for 127.* content
2014-10-08 16:21:14 -07:00
Jessica Frazelle
dbe6c6651e cleanup resolve.conf code
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-10-08 15:15:51 -07:00
Dan Walsh
9ced509e6d Check /etc/resolv.conf every time for 127.* content
Currently if you start the docker -d on a system with 127.0.0.1 in /etc/resolv.conf
It will set the default dns to 8.8.8.8 8.8.4.4 permanently.

This causes a problem at boot on Fedora machines where NetworkManager has not
populated /etc/resolv.conf before docker gets started.

This fix checks /etc/resolv.conf on every docker run. And only populates
daemon.config.Dns  if the user specified it on the command line.

Docker-DCO-1.1-Signed-off-by: Dan Walsh <dwalsh@redhat.com> (github: rhatdan)
2014-10-07 16:19:02 -04:00
Andrea Luzzardi
300c51c3a4 Container#AllocateNetwork: Simplify error handling.
The defer logic was a little tricky and was hiding one bug: `err` was
being redefined (with `:=`) and thus it escaped the defer error checking
logic.

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2014-10-06 17:59:12 -07:00
Andrea Luzzardi
b669025949 Stable MAC addresses: Add support for MAC address restoring.
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2014-10-03 13:46:24 -07:00
Andrea Luzzardi
a487593729 Stable Networking: Keep the same network settings across container restarts.
This change will allocate network settings (IP and public ports) at
container creation rather than start and keep them throughout the
lifetime of the container (i.e. until it gets destroyed) instead of
discarding them when the container is stopped.

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2014-10-03 13:46:24 -07:00
Andrea Luzzardi
deffc572ce Container: Add restore network functionality.
RestoreNetwork() allows the container to restore its NetworkSettings (IP
and public ports).

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2014-10-03 13:46:24 -07:00
Andrea Luzzardi
ab4188c08d Container: Make allocateNetwork and releaseNetwork public.
Since we are moving network allocation outside of container scope (it
will be managed by create/destroy), those functions need to be
accessible from the outside.

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2014-10-03 13:46:24 -07:00
Andrea Luzzardi
103a4e0676 Network Allocation: Proper rollback in case of failure allocation.
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2014-10-03 13:46:24 -07:00
Andrea Luzzardi
88e21c6a75 Support for consistent MAC address.
Right now, MAC addresses are randomly generated by the kernel when
creating the veth interfaces.

This causes different issues related to ARP, such as #4581, #5737 and #8269.

This change adds support for consistent MAC addresses, guaranteeing that
an IP address will always end up with the same MAC address, no matter
what.

Since IP addresses are already guaranteed to be unique by the
IPAllocator, MAC addresses will inherit this property as well for free.

Consistent mac addresses is also a requirement for stable networking (#8297)
since re-using the same IP address on a different MAC address triggers the ARP
issue.

Finally, this change makes the MAC address accessible through docker
inspect, which fixes #4033.

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2014-10-03 13:22:38 -07:00
unclejack
4424d15f99 Merge pull request #8302 from rafecolton/move_archive_package_to_pkg
Move archive package to pkg
2014-10-01 18:03:34 +03:00
Rafe Colton
30d5a42c1f Move archive package into pkg/archive
Now that the archive package does not depend on any docker-specific
packages, only those in pkg and vendor, it can be safely moved into pkg.

Signed-off-by: Rafe Colton <rafael.colton@gmail.com>
2014-09-29 23:23:36 -07:00
Rafe Colton
b845a62149 Move Go() promise-like func from utils to pkg/promise
This is the first of two steps to break the archive package's dependence
on utils so that archive may be moved into pkg.  Also, the `Go()`
function is small, concise, and not specific to the docker internals, so
it is a good candidate for pkg.

Signed-off-by: Rafe Colton <rafael.colton@gmail.com>
2014-09-29 23:16:27 -07:00
Victor Vieux
c2c5e57a8e add apparmor:
Signed-off-by: Victor Vieux <vieux@docker.com>
2014-09-30 00:43:47 +00:00
Michael Crosby
32dca1a7b0 Strongly type exec driver context
This also removes dead code in the native driver for a past feature that
was never fully implemented.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2014-09-29 22:40:26 +00:00
Phil Estes
5239ba3d06 Provide full hostname with domainname to underlying container layer
Addresses #7851

Docker-DCO-1.1-Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com> (github: estesp)
2014-09-25 09:23:39 -04:00
Brian Goff
45407cf00a Split volumes out from daemon
Docker-DCO-1.1-Signed-off-by: Brian Goff <cpuguy83@gmail.com> (github: cpuguy83)
2014-09-19 17:47:47 -05:00
Jessie Frazelle
f98a1f1f7d Merge pull request #8019 from thockin/add-host
Allow extra lines in /etc/hosts
2014-09-16 17:19:16 -07:00
Tim Hockin
68e48b65a6 Allow extra lines in /etc/hosts
This adds a --add-host host:ip flag which appends lines to /etc/hosts.  This is needed in places where you want the container to get a different name resolution than it would through DNS.  This was submitted before as #5525, closed, and now I am re-opening.  It has come up 2 or 3 times in the last couple days.

Signed-off-by: Tim Hockin <thockin@google.com>
2014-09-16 23:38:23 +00:00
Josh Hawn
dee6b481fe Refactor use of graphdriver.Differ
Some graphdrivers are Differs and type assertions are made
in various places throughout the project. Differ offers some
convenience in generating/applying diffs of filesystem layers
but for most graphdrivers another code path is taken.

This patch brings all of the logic related to filesystem
diffs in one place, and simplifies the implementation of some
common types like Image, Daemon, and Container.

Signed-off-by: Josh Hawn <josh.hawn@docker.com>
2014-09-16 15:10:32 -07:00
Vishnu Kannan
bfebdfde78 Splitting the exec remote API into two separate APIs inorder to support resizing of tty sessions.
1. /container/<name>/exec - Creates a new exec command instance in the daemon and container '<name>'. Returns an unique ID for each exec command.
2. /exec/<name>/start - Starts an existing exec command instance. Removes the exec command from the daemon once it completes.

Adding /exec/<name>/resize to resize tty session of an exec command.

Docker-DCO-1.1-Signed-off-by: Vishnu Kannan <vishnuk@google.com> (github: vishh)
2014-09-15 22:56:47 +00:00
Alexandr Morozov
82bdd88e9c Use unlocked version of changes for GetImage
Fixes #7999

Signed-off-by: Alexandr Morozov <lk4d4math@gmail.com>
2014-09-12 11:44:51 +04:00
Alexandr Morozov
555ce0cb54 Use defined variable
Signed-off-by: Alexandr Morozov <lk4d4math@gmail.com>
2014-09-12 11:42:12 +04:00
Michael Crosby
f9c345ddfa Merge pull request #7897 from LK4D4/refactoring_net_mode
Add IsPrivate method for NetworkMode
2014-09-09 14:20:59 -07:00
Alexandr Morozov
080ca86191 Add IsPrivate method for NetworkMode
This method indicates that container using private network stack

Signed-off-by: Alexandr Morozov <lk4d4math@gmail.com>
2014-09-10 00:46:43 +04:00
Jessica Frazelle
f49c3f287b fixes #7802, when api version 1.11 is json.Marshaling the container struct
Signed-off-by: Jessica Frazelle <jfrazelle@users.noreply.github.com>

Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jfrazelle@users.noreply.github.com> (github: )
2014-09-08 09:30:33 -07:00
Alexandr Morozov
ba24820284 Don't initialize network for 'none' mode
Fixes #7837

Signed-off-by: Alexandr Morozov <lk4d4math@gmail.com>
2014-09-04 09:50:58 +04:00
unclejack
76212635b5 move some io related utils to pkg/ioutils
Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
2014-09-03 11:36:21 +03:00
Alexandr Morozov
e0339d4b88
Use State as embedded to Container
Signed-off-by: Alexandr Morozov <lk4d4math@gmail.com>
2014-09-03 00:01:11 +04:00
Vishnu Kannan
3a7e07355a Rename 'StdConfig' to 'StreamConfig'.
Docker-DCO-1.1-Signed-off-by: Vishnu Kannan <vishnuk@google.com> (github: vishh)
2014-09-01 14:31:01 -07:00
Vishnu Kannan
4aa5da278f Refactoring execdriver.Command and Container structs to support 'docker exec' and other
similar features in the future.

Docker-DCO-1.1-Signed-off-by: Vishnu Kannan <vishnuk@google.com> (github: vishh)
2014-09-01 14:30:16 -07:00
Alexandr Morozov
517ba44e37
Merge Container and State mutexes
Resolved all deadlocks and fixed race between kill and
monitor.resetContainer
Fixes #7600

Signed-off-by: Alexandr Morozov <lk4d4math@gmail.com>
2014-08-29 12:56:04 +04:00