Commit graph

44 commits

Author SHA1 Message Date
Antonio Murdaca
15134a3320 Remove PortSpecs from Config
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
2015-05-29 22:38:09 +02:00
Lei Jitang
bcd076b5fe Clean up: remove redundant '\n' in Create
Signed-off-by: Lei Jitang <leijitang@huawei.com>
2015-05-28 17:08:55 +08:00
Brian Goff
b2a43baf2e Use SELinux labels for volumes
Fixes a regression from the volumes refactor where the vfs graphdriver
was setting labels for volumes to `s0` so that they can both be written
to by the container and shared with other containers.
When moving away from vfs this was never re-introduced.
Since this needs to happen regardless of volume driver, this is
implemented outside of the driver.

Fixes issue where `z` and `Z` labels are not set for bind-mounts.

Don't lock while creating volumes

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2015-05-27 13:43:38 -07:00
Arnaud Porterie
bce3e761c0 Merge pull request #13161 from calavera/plugin_discovery
Proposal: Volume refactor and external volume plugins
2015-05-23 18:44:18 -07:00
David Calavera
d592778f4a Propagate unmount events to the external volume drivers.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-05-22 16:43:34 -07:00
Qiang Huang
84aae5a226 Don't check running container at create time
We should let user create container even if the container he wants
join is not running, that check should be done at start time.

In this case, the running check is done by getIpcContainer() when
we start container.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2015-05-23 07:15:14 +08:00
Arnaud Porterie
2653c7c16c Make API volume-driver dependent on 'experimental'
Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
2015-05-21 20:34:17 -07:00
David Calavera
81fa9feb0c Volumes refactor and external plugin implementation.
Signed by all authors:

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
Signed-off-by: David Calavera <david.calavera@gmail.com>
Signed-off-by: Jeff Lindsay <progrium@gmail.com>
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Signed-off-by: Luke Marsden <luke@clusterhq.com>
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-05-21 20:34:17 -07:00
Qiang Huang
a2f39e7754 Fix oom kill disable issue
It should not be hard limit, we should only check oom kill disable
when user using it.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2015-05-10 14:55:00 +08:00
HuKeping
a4a924e1b6 Feature: option for disable OOM killer
Add cgroup support for disable OOM killer.

Signed-off-by: Hu Keping <hukeping@huawei.com>
2015-05-04 21:11:29 +08:00
John Howard
03eb0d065d Windows: Move workdir check daemon-side
Signed-off-by: John Howard <jhoward@microsoft.com>
2015-04-30 14:16:45 -07:00
Ma Shimiao
93cdb0071b optimize code to clarify logic
Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
2015-04-16 19:56:25 +08:00
David Calavera
767df67e31 Decode container configurations into typed structures.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-04-15 10:22:07 -07:00
David Calavera
98996a432e Remove engine.Job from Create action.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-04-14 15:33:12 -07:00
David Calavera
610c436e07 Remove engine.Job from Start action.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-04-14 15:33:12 -07:00
Lei Jitang
013fb87543 Fix error from daemon no such image even when the image exist
Signed-off-by: Lei Jitang <leijitang@huawei.com>
2015-03-28 09:07:20 +08:00
Qiang Huang
40ef253ef5 add back job.Errorf
c79b9bab54 (Remove engine.Status and replace it with standard go error)
cause a regression that create container won't get any warnings, we still
need this to send useful informations to user.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2015-03-26 13:12:36 +08:00
Antonio Murdaca
c79b9bab54 Remove engine.Status and replace it with standard go error
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
2015-03-25 22:32:08 +01:00
Qiang Huang
55cc166e53 do not warning when we disable memoryswap
$ docker run -ti --rm -m 300M --memory-swap=-1 ubuntu:14.04
WARNING: Your kernel does not support swap limit capabilities. Limitation discarded.
root@813aafc019d5:/#

When we disable memoryswap, it should not warning swap limit not support.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2015-03-18 10:08:17 +08:00
Ma Shimiao
703cab12e7 fix not show error when using --lxc-conf without lxc driver
Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
2015-03-17 08:50:17 +08:00
Qiang Huang
837eec064d move resources from Config to HostConfig
Cgroup resources are host dependent, they should be in hostConfig.

For backward compatibility, we just copy it to hostConfig, and leave it in
Config for now, so there is no regressions, but the right way to use this
throught json is to put it in HostConfig, like:
  {
      "Hostname": "",
      ...
      "HostConfig": {
	  "CpuShares": 512,
          "Memory": 314572800,
          ...
      }
  }

As we will add CpusetMems, CpusetCpus is definitely a better name, but some
users are already using Cpuset in their http APIs, we also make it compatible.

The main idea is keep using Cpuset in Config Struct, and make it has the same
value as CpusetCpus, but not always, some scenarios:
 - Users use --cpuset in docker command, it can setup cpuset.cpus and can
   get Cpuset field from docker inspect or other http API which will get
   config info.
 - Users use --cpuset-cpus in docker command, ditto.
 - Users use Cpuset field in their http APIs, ditto.
 - Users use CpusetCpus field in their http APIs, they won't get Cpuset field
   in Config info, because by then, they should already know what happens
   to Cpuset.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2015-03-11 09:31:18 +08:00
Alexander Morozov
6efecb7b41 Merge pull request #10186 from rhatdan/selinux-build
Turn on Security opts including labeling for docker build
2015-02-06 14:11:21 -08:00
Michael Crosby
34c804a139 Merge pull request #9705 from acbodine/9311-truncindex-error-duplicate-id-on-ambiguous-id
Closes #9311 Handles container id/name collisions against daemon functionalities according to #8069
2015-02-06 14:01:28 -08:00
Dan Walsh
8a8dcf1930 Turn on Security opts including labeling for docker build
Currently docker build is not passing HostConfig to daemon.Create.
this patch creates the default HostConfig and passes it to daemon.Create.
This will cause the SELinux labeling to turn on for docker build.  Basically
it causes a SecurtyOpt field to be created.  In the future this might also
allow us to use seccomp and UserNamespace with docker build.

Docker-DCO-1.1-Signed-off-by: Dan Walsh <dwalsh@redhat.com> (github: rhatdan)
2015-02-05 12:33:22 +01:00
Qiang Huang
72f356be6a add check for memoryswap when create
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2015-02-05 09:05:27 +08:00
Andrew C. Bodine
d25a65375c Closes #9311 Handles container id/name collisions against daemon functionalities according to #8069
Signed-off-by: Andrew C. Bodine <acbodine@us.ibm.com>
2015-01-21 17:11:31 -08:00
Dan Walsh
23feaaa240 Allow the container to share the PID namespace with the host
We want to be able to use container without the PID namespace.  We basically
want containers that can manage the host os, which I call Super Privileged
Containers.  We eventually would like to get to the point where the only
namespace we use is the MNT namespace to bring the Apps userspace with it.

By eliminating the PID namespace we can get better communication between the
host and the clients and potentially tools like strace and gdb become easier
to use.  We also see tools like libvirtd running within a container telling
systemd to place a VM in a particular cgroup, we need to have communications of the PID.

I don't see us needing to share PID namespaces between containers, since this
is really what docker exec does.

So currently I see us just needing docker run --pid=host

Docker-DCO-1.1-Signed-off-by: Dan Walsh <dwalsh@redhat.com> (github: rhatdan)
2015-01-13 16:35:17 -08:00
Sebastiaan van Stijn
5f699a465d Fix typo in error-message.
This fixes a small typo in the errormessage for memory-swap.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2015-01-12 21:48:44 +01:00
Alexander Morozov
748b7459b3 Merge pull request #9603 from hqhq/hq_add_memory_swap
add support to set MemorySwap
2015-01-06 10:09:21 -08:00
Josh Hawn
8936789919 Make FROM scratch a special cased 'no-base' spec
There has been a lot of discussion (issues 4242 and 5262) about making
`FROM scratch` either a special case or making `FROM` optional, implying
starting from an empty file system.

This patch makes the build command `FROM scratch` special cased from now on
and if used does not pull/set the the initial layer of the build to the ancient
image ID (511136ea..) but instead marks the build as having no base image. The
next command in the dockerfile will create an image with a parent image ID of "".
This means every image ever can now use one fewer layer!

This also makes the image name `scratch` a reserved name by the TagStore. You
will not be able to tag an image with this name from now on. If any users
currently have an image tagged as `scratch`, they will still be able to use that
image, but will not be able to tag a new image with that name.

Goodbye '511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158',
it was nice knowing you.

Fixes #4242

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
2014-12-18 14:03:38 -08:00
Qiang Huang
1a9b640e0d add support to set MemorySwap
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2014-12-10 16:53:43 -08:00
Jessie Frazelle
67fda33197 Merge pull request #9089 from cpuguy83/8942_create_volumes_on_create
Initialize volumes when container is created
2014-12-03 15:42:09 -08:00
Blake Geno
9200fdd197 remove obsolete workaround
Signed-off-by: Blake Geno <blakegeno@gmail.com>
2014-12-01 11:44:13 -05:00
Michael Crosby
294843ef23 Move security opts to HostConfig
These settings need to be in the HostConfig so that they are not
committed to an image and cannot introduce a security issue.

We can safely move this field from the Config to the HostConfig
without any regressions because these settings are consumed at container
created and used to populate fields on the Container struct.  Because of
this, existing settings will be honored for containers already created
on a daemon with custom security settings and prevent values being
consumed via an Image.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>

Conflicts:
	daemon/create.go
		changing config to hostConfig was required to fix the
		 build
2014-11-25 01:02:30 +02:00
Brian Goff
7107898d5c Initialize volumes when container is created
Fixes #8942
Current behavior is that volumes aren't initialized until start.
Volumes still need to be initialized on start since VolumesFrom and
Binds can be passed in as part of HostConfig on start, however anything
that's already been initialized will just be skipped as is the current
behavior.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2014-11-14 11:37:03 -05:00
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
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
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
1df87b9506 API: Provide the HostConfig during "run".
Currently, the HostConfig is only passed from the CLI to Docker only
when issuing a docker create, but not when doing a docker run.

In the near future, in order to allocate ports at creation time rather
than start time, we will need to have the HostConfig readily available
at container creation.

This PR makes the client always pass the HostConfig when creating a
container (regardless of whether it's for a run or create).

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2014-09-25 15:24:38 -07:00
Michael Crosby
9b755412ab Update memory limit for container
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2014-09-22 21:41:14 +00:00
Alexander Larsson
3a90004f3c Add "docker create" support
This exposes the already existing "create container" operation.  It is
very similar to "docker run -d" except it doesn't actually start the
container, but just prepares it. It can then be manually started using
"docker start" at any point.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)

Conflicts:
	api/client/commands.go
	runconfig/parse.go
	server/container.go

Docker-DCO-1.1-Signed-off-by: Tibor Vass <teabee89@gmail.com> (github: tiborvass)
2014-09-16 18:40:24 -04:00
Solomon Hykes
2a39635d30 Cleanup: move image depth checks in image/
Signed-off-by: Solomon Hykes <solomon@docker.com>
2014-08-15 00:43:12 +00:00
Alexandr Morozov
8d056423f8 Separate events subsystem
* Events subsystem merged from `server/events.go` and
  `utils/jsonmessagepublisher.go` and moved to `events/events.go`
* Only public interface for this subsystem is engine jobs
* There is two new engine jobs - `log_event` and `subscribers_count`
* There is auxiliary function `container.LogEvent` for logging events for
  containers

Docker-DCO-1.1-Signed-off-by: Alexandr Morozov <lk4d4math@gmail.com> (github: LK4D4)
[solomon@docker.com: resolve merge conflicts]
Signed-off-by: Solomon Hykes <solomon@docker.com>
2014-08-06 10:08:19 +00:00
Solomon Hykes
80f3272ee9 Move "create" to daemon/create.go
This is part of an effort to break apart the deprecated server/ package

Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
2014-08-01 14:16:50 -04:00