Commit Graph

240 Commits

Author SHA1 Message Date
Justin Cormack
98732e8936 Fixes for output types
Make `raw` output type call its file `.raw` as well, other minor fixes.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-06-07 16:46:36 +01:00
Justin Cormack
68ffbb5e7e Merge pull request #72 from justincormack/rename-images
Rename img→raw and gcp-img→gcp
2017-06-07 16:38:29 +01:00
Justin Cormack
d906292096 Merge pull request #73 from justincormack/docker
Add an output format for running images with Docker
2017-06-07 16:38:14 +01:00
Justin Cormack
9a3ac36236 Add an example of building an application and running in Docker or LinuxKit
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-06-07 16:24:32 +01:00
Justin Cormack
dbe50976c3 Add suitable init for running in a container
This goes with the experimental `docker` output format.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-06-07 15:33:52 +01:00
Justin Cormack
8abeffde59 Add Docker output format
This will add a Dockerfile which will build the contents into an
image and then call `tinit` to start it.

This is fairly experimental, but is a prototype for other non
LinuxKit outputs. The container will need to run as `privileged`
as `runc` needs quite a few capabilities and `containerd` needs to
mount.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-06-07 15:32:02 +01:00
Justin Cormack
eabe03b702 Rename img→raw and gcp-img→gcp
- generally people refer to a plain disk image as `raw`
- `gcp` is shorter and it is the only image type supported
- remove `img-gz` as it is not needed. It does not really save space
  as you have to build the full image and compress it anyway. On
  many platforms the `raw` image will be a sparse file anyway,
  even on the Mac soon.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-06-07 14:43:43 +01:00
Justin Cormack
ca677b3c40 Merge pull request #71 from justincormack/output-file
Use streaming output where possible
2017-06-07 14:28:44 +01:00
Justin Cormack
c2806000e0 Use streaming APIs rather than buffers for building
This should lower memory usage a lot and should be faster.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-06-07 12:13:12 +01:00
Justin Cormack
b086231008 Allow streaming output for tar
This is a little ugly in terms of the validation now, but it is a move towards
splitting "build" and "package".

The "tar" output (and soon others) can output direct to a file or to stdout.
Obviously you can only build a single output format like this.

The LinuxKit output formats that build disk images cannot stream as they
have to build whole images. These allow multiple outputs.

In future we will probably change to
```
moby build | moby package
```

or similar, but that is a bit ugly, so currently have a compromise where
there are essentially two output types.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-06-06 14:50:28 +01:00
Justin Cormack
181c66d42c Merge pull request #70 from justincormack/multiple-yaml
Allow specification of multiple yaml files for a single build
2017-06-05 16:39:31 +01:00
Justin Cormack
3a16c02f10 Merge pull request #69 from justincormack/gcp-fix
Do not use Linuxkit to build GCP images for now
2017-06-05 15:37:48 +01:00
Justin Cormack
e879037646 Disable use of linuxkit for GCP for now
GCP does not recognise the images, even though they appear identical to those made
by libguestfs and work on qemu fine. Their validation code does not like them for some
reason.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-06-05 15:31:45 +01:00
Justin Cormack
503545a2de Merge pull request #67 from riyazdf/trust-caching
trust: check local image cache to not pull every time
2017-06-04 19:31:47 +01:00
Justin Cormack
54e58f2808 Allow specification of multiple yaml files for a single build
Each section will be appended in order of the CLI, other then
kernel where last specified one wins.

This is useful if you eg want to have a base version for (say)
AWS and GCP and then add your own image on top.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-06-04 17:50:13 +01:00
Riyaz Faizullabhoy
6c6190172c trust: include trust configuration in docker inspect for OCI config
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2017-06-02 15:18:55 -07:00
Justin Cormack
058ce768f4 Merge pull request #66 from justincormack/linuxkit-part2
Add the temporary directories under ~/.moby
2017-06-02 22:39:41 +01:00
Justin Cormack
5b73f53dcf Put tmp direcories under ~/.moby
Docker4Mac won't bind mount default tmp dir into containers

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-06-02 22:36:21 +01:00
Riyaz Faizullabhoy
6221552204 trust: check local image cache to not pull every time
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2017-06-02 13:03:47 -07:00
Justin Cormack
294389aef9 Merge pull request #49 from justincormack/linuxkit
Use linuxkit to build qcow2 and raw image disks, rather than docker containers with libguestfs
2017-06-02 16:39:28 +01:00
Justin Cormack
249bbc56ed Use linuxkit to build qcow2 and raw image disks, rather than docker containers with libguestfs
- does not require docker if user has qemu natively, will still fall back to docker
- allow specifying size for fixed size disk images
- add a raw disk output format
- more dogfooding
- marginally slower, but can be improved later

The images used to do the build are cached to make the process quicker.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-06-02 16:33:06 +01:00
Justin Cormack
d599aedb7f Merge pull request #62 from riyazdf/config-dir-trust
add default trust config and cache dir
2017-06-02 16:25:52 +01:00
Riyaz Faizullabhoy
46b77f699f add default config and cache dir, initially use for trust
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2017-06-02 08:14:03 -07:00
Justin Cormack
dd60edc884 Merge pull request #65 from justincormack/mobydir
Add a ~/.moby directory for config
2017-06-02 15:16:31 +01:00
Justin Cormack
cf8d8ca014 Add a ~/.moby directory for config
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-06-02 15:12:00 +01:00
Justin Cormack
cde8329d2f Merge pull request #61 from FrenchBen/validate-output
Validate output before doing the work
2017-06-01 22:39:56 +01:00
Justin Cormack
edcf4d0362 Merge pull request #59 from riyazdf/trust-parse-fixes-and-tests
trust: parsing fixes and tests
2017-06-01 22:35:59 +01:00
French Ben
23856c1e46 Validate output before doing the work
Signed-off-by: French Ben <frenchben@docker.com>
2017-06-01 14:30:41 -07:00
Riyaz Faizullabhoy
e0fc007b5a test cases with default golang lib
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2017-06-01 11:27:01 -07:00
Riyaz Faizullabhoy
99eeb981a7 trust: improve org checks to enable library official repo checks
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2017-06-01 11:20:36 -07:00
Justin Cormack
dec7f8bb2b Merge pull request #58 from riyazdf/disable-trust-flag
add disable-content-trust flag for one-off build
2017-06-01 10:52:36 +01:00
Riyaz Faizullabhoy
32f167bd9e trust: fix splitting on tags and digests and add tests
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2017-05-31 16:42:42 -07:00
Riyaz Faizullabhoy
1ecfc11160 add disable-content-trust flag for one-off build
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2017-05-31 14:51:59 -07:00
Justin Cormack
5cd1e4e2ae Merge pull request #56 from justincormack/host-root
Change the default namespaces
2017-05-30 15:35:01 +01:00
Justin Cormack
dfd57aeeee Change the default namespaces
Default to sharing net, ipc, uts namespaces between containers in config.
This makes most sense, as this is normal other than if we want to specifically
isolate system containers, in which case we will specify in config.

- explicitly support the value "new" if you want to isolate
- support the synonym "root" for "host" as in non LinuxKit setups it may
  not actually be the host, it will be the current namespace.
- only support "none" as a synonym for "new" for network namespace where it is
  carried over from Docker.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-05-30 14:41:33 +01:00
Justin Cormack
101fa30ef3 Merge pull request #54 from riyazdf/trust-tag-fix
trust: always tag after pull
2017-05-27 10:33:27 +01:00
Riyaz Faizullabhoy
81d17913d1 trust: always tag after pull
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2017-05-26 18:44:58 -07:00
Justin Cormack
5111146a4f Merge pull request #53 from riyazdf/rbind
Always include rbind in user-specified volume options
2017-05-26 23:56:06 +01:00
Riyaz Faizullabhoy
11ebab55e2 Always include rbind in user-specified options
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2017-05-26 15:39:57 -07:00
Justin Cormack
4e4629e05c Merge pull request #51 from riyazdf/trust-tmpdir
trust: use a tempdir and remove after build
2017-05-26 22:47:37 +01:00
Riyaz Faizullabhoy
92aa526b9d trust: use a tempdir and remove after build
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2017-05-26 14:29:44 -07:00
Justin Cormack
e8dc61e910 Merge pull request #48 from justincormack/dir-fixes
Fix build in directory
2017-05-26 15:28:18 +01:00
Justin Cormack
b8cdb985fd Fix build in directory
Remove unnecessary argument to buildInternal function, does not need to know the name.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-05-26 15:22:12 +01:00
Justin Cormack
2cd3a5b141 Merge pull request #47 from justincormack/dir
Add a -dir option for location of output files
2017-05-26 15:02:29 +01:00
Justin Cormack
f73558a98a Add a -dir option for location of output files
Fix #17

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-05-26 14:53:17 +01:00
Justin Cormack
5de12a0085 Merge pull request #46 from justincormack/gitignore
Fix gitignore to not ignore moby directory
2017-05-26 14:47:45 +01:00
Justin Cormack
27709ce1c0 Fix gitignore to not ignore moby directory
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-05-26 14:45:19 +01:00
Justin Cormack
1cb9fab3e1 Merge pull request #45 from justincormack/clean
Add make clean, .gitignore
2017-05-26 13:34:06 +01:00
Justin Cormack
f6b9076649 Merge pull request #43 from justincormack/outputs-not-in-yaml
Remove output formats from the Yaml file, put in CLI
2017-05-26 13:33:17 +01:00
Justin Cormack
cbbedbfc57 Remove output formats from the Yaml file, put in CLI
This removes outputs from yaml, instead you can do
```
moby build -output tar -output qcow2 file.yaml
```
or alternative syntax
```
moby build -output tar,qcow2 file.yaml
```

In future we may change this to be available in a `moby package`
step, but lets try this for now.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-05-26 13:00:45 +01:00