Commit graph

97 commits

Author SHA1 Message Date
Doug Davis
f7d4b4fe2b Convert some "daemon" static error strings to the new errocode package format
Signed-off-by: Doug Davis <dug@us.ibm.com>
2015-09-16 16:16:42 -07:00
David Calavera
2c6c07752c Remove volume references when container creation fails.
Volumes are accounted when a container is created.
If the creation fails we should remove the reference from the counter.
Do not log ErrVolumeInUse as an error, having other volume references is
not an error.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-09-14 16:16:46 -04:00
Stephen Rust
0ef740a5bf Don't hold lock around volume driver for volume create.
Signed-off-by: Stephen Rust <srust@blockbridge.com>
2015-08-28 16:28:28 -04:00
Brian Goff
b3b7eb2723 Add volume API/CLI
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2015-08-26 13:37:52 -04:00
John Howard
72c04ab87c Tidy volume*.go
Signed-off-by: John Howard <jhoward@microsoft.com>
2015-07-31 13:13:40 -07:00
John Howard
47c56e4353 Windows: Factoring out unused fields
Signed-off-by: John Howard <jhoward@microsoft.com>
2015-07-27 17:44:18 -07:00
Dan Walsh
4cb9479ce4 Rename internel field Relabel to Mode
Docker-DCO-1.1-Signed-off-by: Dan Walsh <dwalsh@redhat.com> (github: rhatdan)
2015-07-24 07:14:37 -04:00
Josh Hawn
c32dde5baa daemon: container ArchivePath and ExtractToDir
The following methods will deprecate the Copy method and introduce
two new, well-behaved methods for creating a tar archive of a resource
in a container and for extracting a tar archive into a directory in a
container.

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
2015-07-21 11:20:10 -07:00
David Calavera
c4d45b6a29 Promote volume drivers from experimental to master.
Remove volume stubs and use the experimental path as the only path.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-07-21 09:32:44 -07:00
Alexander Morozov
c86189d554 Update libcontainer
Replaced github.com/docker/libcontainer with
github.com/opencontainers/runc/libcontaier.
Also I moved AppArmor profile generation to docker.

Main idea of this update is to fix mounting cgroups inside containers.
After updating docker on CI we can even remove dind.

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-07-16 16:02:26 -07:00
David Calavera
82a54001fd Fix read-write check for volumes.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-07-14 15:50:43 -07:00
David Calavera
ecdbf86884 Merge pull request #13694 from vdemeester/opts-test-coverage
Tests, refactor and coverage on package opts
2015-07-14 15:09:48 -07:00
Dan Walsh
b28d6eaa94 We now support multiple roModes
Docker-DCO-1.1-Signed-off-by: Dan Walsh <dwalsh@redhat.com> (github: rhatdan)
2015-07-13 09:19:15 -04:00
Vincent Demeester
dfc6c04fa3 Add test coverage to opts and refactor
- Refactor opts.ValidatePath and add an opts.ValidateDevice
  ValidePath will now accept : containerPath:mode, hostPath:containerPath:mode
  and hostPath:containerPath.
  ValidateDevice will have the same behavior as current.

- Refactor opts.ValidateEnv, opts.ParseEnvFile
  Environment variables will now be validated with the following
  definition :
  > Environment variables set by the user must have a name consisting
  > solely of alphabetics, numerics, and underscores - the first of
  > which must not be numeric.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2015-07-12 10:33:30 +02:00
John Howard
52f4d09ffb Windows: Graph driver implementation
Signed-off-by: John Howard <jhoward@microsoft.com>
2015-07-10 14:33:11 -07:00
David Calavera
3d029c3bf3 Fix volumes-from mount references.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-07-09 09:01:57 -06:00
John Howard
3c177dc877 Windows: Docker build starting to work
Signed-off-by: John Howard <jhoward@microsoft.com>
2015-06-17 10:41:28 -07:00
David Calavera
bd9814f0db Allow to downgrade local volumes from > 1.7 to 1.6.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-06-09 18:04:59 -07:00
John Howard
71eadd4176 Windows: Fix PR13278 compile break
Signed-off-by: John Howard <jhoward@microsoft.com>
2015-06-08 13:47:09 -07:00
Brian Goff
a2602c617d Merge pull request #13684 from lizf-os/cleanup-verify-volumes-info
Cleanup Daemon.verifyVolumesInfo() a bit
2015-06-04 15:39:31 -07:00
David Calavera
16a5590c5b Migrate data from old vfs paths to new local volumes path.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-06-04 10:16:19 -07:00
Zefan Li
8b4c0decfc Cleanup Daemon.verifyVolumesInfo() a bit
vols.VolumesRW has been initialized so it can't be nil. Furthermore
it's ok to read a nil map.

Signed-off-by: Zefan Li <lizefan@huawei.com>
2015-06-03 09:19:16 +08:00
David Calavera
53d9609de4 Mount bind volumes coming from the old volumes configuration.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-05-28 14:06:17 -07: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
Jessica Frazelle
af7d17a6c9 apply selinux labels volume patch on volumes refactor
Signed-off-by: Jessica Frazelle <princess@docker.com>
2015-05-27 12:50:16 -07:00
Josh Hawn
04f99a6ca8 Fix container unmount networkMounts
UnmountVolumes used to also unmount 'specialMounts' but it no longer does after
a recent refactor of volumes. This patch corrects this behavior to include
unmounting of `networkMounts` which replaces `specialMounts` (now dead code).

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
2015-05-26 17:38:26 -07:00
David Calavera
3bf0ca31cf Allow named volumes for external drivers.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-05-21 20:34:17 -07: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
Arnaud Porterie
7da5a7eb66 Disable -v overloading
Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
(cherry picked from commit ec5a362fb93358244305067419589f602fd33807)
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
John Howard
b9e4b95788 Windows: Refactor container
Signed-off-by: John Howard <jhoward@microsoft.com>
2015-05-16 12:38:20 -07:00
mauriyouth
7d371c0b47 Make /etc/hosts, /etc/resolv.conf, /etc/hostname read only if --read-only is enable
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
2015-05-04 21:30:52 +02:00
Brian Goff
d2f0b9ed97 Merge pull request #11190 from cyphar/expose-path-sanitisation-wrappers
Expose the getResourcePath and getRootResourcePath wrappers.
2015-04-28 18:45:36 -04:00
John Howard
ba1725a94e Windows: Refactor volumes
Signed-off-by: John Howard <jhoward@microsoft.com>
2015-04-27 09:27:15 -07:00
Aleksa Sarai
4377ebd6a7 *: expose getResourcePath and getRootResourcePath wrappers
Due to the importance of path safety, the internal sanitisation wrappers
for volumes and containers should be exposed so other parts of Docker
can benefit from proper path sanitisation.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com> (github: cyphar)
2015-04-24 23:53:47 +10:00
Brian Goff
f3680e7494 Cleanup daemon/volumes
- Mount struct now called volumeMount
- Merged volume creation for each volume type (volumes-from, binds, normal
  volumes) so this only happens in once place
- Simplified container copy of volumes (for when `docker cp` is a
  volume)

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2015-04-22 19:32:10 -04:00
Brian Goff
8ce42baaef Make docker cp bind-mount volumes
Allows `docker cp` to work seamlessly, and a lot more cleanly.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2015-04-14 15:42:56 -04:00
Brian Goff
63708dca8a Use getResourcePath instead
Also cleans up tests to not shell out for file creation.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2015-03-31 15:10:30 -04:00
Lei Jitang
7583b49125 Fix create volume in a directory which is a symbolic link
Signed-off-by: Lei Jitang <leijitang@huawei.com>
2015-03-29 13:35:36 +08:00
Antonio Murdaca
6f4d847046 Replace aliased imports of logrus, fixes #11762
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
2015-03-26 23:22:04 +01:00
Jessie Frazelle
1fe55b2f8b Merge pull request #10365 from cpuguy83/9981_fix_cannot_overwrite_nonbind_as_bind
Allow path from normal volume existing to overwrite in start Binds
2015-03-23 10:43:02 -07:00
Rik Nijessen
1ec2eac50d Make utils_daemon and volumes cross-platform compileable.
Signed-off-by: Rik Nijessen <riknijessen@gmail.com>
2015-03-16 11:46:07 +01:00
Dan Walsh
4eb2fd169f Two SELinux Changes.
daemon/volumes.go

  This SetFileCon call made no sense, it was changing the labels of any
directory mounted into the containers SELinux label.  If it came from me,
then I apologize since it is a huge bug.

The Volumes Mount code should optionally do this, but it should not always
happen, and should never happen on a --privileged container.

The change to

daemon/graphdriver/vfs/driver.go, is a simplification since this it not
a relabel, it is only a setting of the shared label for docker volumes.

Docker-DCO-1.1-Signed-off-by: Dan Walsh <dwalsh@redhat.com> (github: rhatdan)
2015-03-05 13:55:44 -05:00
Michal Minar
d96e885314 Fixed bad handling of "container not found" error
Create container job could fail because a container specified with
`--volumes-from` does not exist. This error is not propagated to client
though. Instead it's recognized by higher levels as "image not found".
Client then tries to pull the image and launch the container again.

This patch changes the lower level error message so that it's not
recognized as "image not found" and thus it's propagated to client.

Signed-off-by: Michal Minar <miminar@redhat.com>
2015-02-24 15:52:47 +01:00
Brian Goff
7122b6643e Check nil volume on mount init
Fixes #10685 panic in some cases.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2015-02-21 07:21:57 -05:00
Lei Jitang
fa228d8cbc Fix create volume /etc cover /etc/{hosts,resolv.conf,hostname}
Signed-off-by: Lei Jitang <leijitang@huawei.com>
2015-02-12 08:46:53 +08:00
Brian Goff
49e1ad49c8 Allow normal volume to overwrite in start Binds
Fixes #9981
Allows a volume which was created by docker (ie, in
/var/lib/docker/vfs/dir) to be used as a Bind argument via the container
start API and overwrite an existing volume.

For example:

```bash
docker create -v /foo --name one
docker create -v /foo --name two
```

This allows the volume from `one` to be passed into the container start
API as a bind to `two`, and it will overwrite it.

This was possible before 7107898d5c

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2015-02-10 20:46:37 -05:00
Tibor Vass
b0ed2da441 Merge pull request #10112 from cpuguy83/4393_fix_volume_where_file_exists
Error out if file in container at volume path
2015-02-06 19:39:48 -05:00
Jessie Frazelle
271a073a04 Merge pull request #10622 from estesp/10618-err-ondup-bind-vols
Don't allow duplicate `-v` specifications for the same target
2015-02-06 15:03:56 -08:00
Brian Goff
c73e3bf4dc Error out if file in container at volume path
Fixes #4393

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2015-02-06 18:00:00 -05:00