Commit Graph

436 Commits

Author SHA1 Message Date
John Howard
59ea134ce1 OCI Modifiers for Windows
Signed-off-by: John Howard <jhoward@microsoft.com>

Needed for the containerd work on Windows and integrating the
oci package from containerd into moby.

No longer sets defaults for
 - .Process.ConsoleSize
 - .Windows.IgnoreFlushesDuringBoot
 - .Windows.Network.AllowUnqualifiedDNSQuery

Adds helper functions and tests for
 - WithWindowsIgnoreFlushesDuringBoot
 - WithWindowNetworksAllowUnqualifiedDNSQuery

Updates `ctr run` on Windows to use the new helper functions,
ConsoleSize is already handled.
2019-02-06 10:44:36 -08:00
Phil Estes
df97414a77
Merge pull request #2622 from kadisi/export_bug
fix ctr image export not found error
2019-01-16 12:59:34 -05:00
Phil Estes
06e04bc5a9
Merge pull request #2830 from Ace-Tang/support_cr_without_image
cr: support checkpoint/restore without image
2018-12-20 13:24:37 -05:00
kadisi
40267382c5 fix ctr image export not found error
Signed-off-by: Jie Zhang <iamkadisi@163.com>
2018-12-17 08:52:28 +08:00
Wei Fu
603e97a9ec ctr/content: make editor flag is required
The $EDITOR is not clear for user. If the env doesn't set the value for
$EDITOR, the users don't know how to use this subcommand when they get
error like this:

```
sh: 1: /tmp/edit-605573012: Permission denied
```

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2018-12-11 18:55:09 +08:00
Justin Terry (VM)
7ac221e8d7 Adding ctr memory and cpu flags
Adds ctr run --memory-limit for all platforms.
Adds ctr run --cpu-count for Windows platforms.

Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
2018-12-10 13:31:59 -08:00
Michael Crosby
4a8acf54b1
Merge pull request #2793 from lifubang/runexecflag
fix container cmd args may parsed as ctr args
2018-12-04 11:05:51 -05:00
Lifubang
2d3a4f99ec should no defer when detach
Signed-off-by: Lifubang <lifubang@acmcoder.com>
2018-12-03 19:18:57 +08:00
Ace-Tang
6593399e9f cr: support checkpoint/restore without image
support checkpoint without committing a checkpoint dir into a
checkpoint image and restore without untar image into checkpoint
directory. support for both v1 and v2 runtime

Signed-off-by: Ace-Tang <aceapril@126.com>
2018-11-29 10:19:39 +08:00
Justin Terry (VM)
f90e5d564a Move ctr run --isolation to Windows only
Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
2018-11-23 17:11:59 -08:00
Ace-Tang
461222dba8 fix: should get runtime name from container info
when use `ctr t checkpoint`, runtime name should get from container
info, but not passed by flag, since task has already running with
specified runtime

Signed-off-by: Ace-Tang <aceapril@126.com>
2018-11-23 15:39:43 +08:00
Derek McGowan
32aa0cd79b
Merge pull request #2632 from ehazlett/checkpoint-restore
Refactor checkpoint and restore to client
2018-11-20 16:31:08 -08:00
Lifubang
2101b1362e add ctr delete --exec-id to debug DeleteProcess
Signed-off-by: Lifubang <lifubang@acmcoder.com>
2018-11-20 19:53:06 +08:00
Phil Estes
55baf50b5a
Merge pull request #2798 from lifubang/execd
add flag -d for ctr t exec to run a service in container
2018-11-20 08:34:29 +08:00
Lifubang
01f5aa3878 add flag -d for ctr t exec to run a service in container
Signed-off-by: Lifubang <lifubang@acmcoder.com>
2018-11-16 14:29:45 +08:00
Lifubang
51ad4d3020 change args usage for ctr c create
Signed-off-by: Lifubang <lifubang@acmcoder.com>
2018-11-16 14:09:39 +08:00
Lifubang
bd2a21985c fix container cmd args may parsed as ctr args
Signed-off-by: Lifubang <lifubang@acmcoder.com>
2018-11-15 18:32:04 +08:00
Evan Hazlett
6f2f4e4343 checkpoint: add copts to checkpoint; save snapshotter to annotation
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
2018-11-12 11:48:16 +00:00
Evan Hazlett
40caece8dc update tests
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
2018-11-12 11:47:17 +00:00
Evan Hazlett
4fdf720b84 move rw to opt; make snapshot opt; move to NewContainerOpts
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
2018-11-12 11:47:17 +00:00
Evan Hazlett
147208061c add image name and runtime name media types; remove task operation on checkpoint
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
2018-11-12 11:47:17 +00:00
Evan Hazlett
ce0673fd7d Restore take image
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
2018-11-12 11:47:17 +00:00
Evan Hazlett
0e4d9da755 remove task handling from Restore
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
2018-11-12 11:47:16 +00:00
Evan Hazlett
2d3db08daf refactor spec and snapshot restore into opts
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
2018-11-12 11:45:22 +00:00
Evan Hazlett
45c700a955 refactor checkpoint and restore to client
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
2018-11-12 11:45:22 +00:00
Akihiro Suda
dd0539b095 ctr: add --cgroup for oci.WithCgroup
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2018-11-06 17:39:30 +09:00
Michael Crosby
2a10bc7b44
Merge pull request #2759 from fuweid/bugfix_use_right_flag_value
bugfix: use skip-verify flag not insecure in ctr
2018-11-05 14:20:56 -05:00
Justin Terry (VM)
354dab0caa Forward ctr.exe --debug as io.containerd.runhcs.v1 options
Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
2018-11-05 09:08:48 -08:00
Wei Fu
a02f7cea86 bugfix: use skip-verify flag in ctr instead of insecure
Signed-off-by: Wei Fu <fuweid89@gmail.com>
2018-11-02 23:51:37 +08:00
Ace-Tang
c3cac72b92 ctr: fix potential panic in metric
Signed-off-by: Ace-Tang <aceapril@126.com>
2018-10-23 14:01:50 +08:00
Michael Crosby
f1dfe86ef4
Merge pull request #2688 from crosbymichael/ctrdecodespec
decode spec in `ctr c info`
2018-10-16 09:38:43 -04:00
Michael Crosby
9fe52f66d6
Merge pull request #2721 from Ace-Tang/master
ctr: add some metric item
2018-10-16 09:38:30 -04:00
Ace-Tang
7ea75ef4a9 ctr: add some metric item
add memory limit, pid info into metric subcommand, since moby also
show them. As blkio read/write IO need more calculation,not add them.

Signed-off-by: Ace-Tang <aceapril@126.com>
2018-10-16 16:54:06 +08:00
Phil Estes
1a5f9a3434
Merge pull request #2710 from fuweid/enhance_support_duration_for_cpu_profile_collection
enhance: support specific duration for profile collection
2018-10-11 11:00:25 -04:00
Wei Fu
a2a23d91ca enhance: support specific duration for profile collection
The default duration of cpu profile collection in net/http/pprof is 30
seconds. User should have chance to set the specific duration for the
collection.

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2018-10-10 22:57:54 +08:00
Phil Estes
43acab8100
Merge pull request #2690 from dmcgowan/resolver-updates
Update Docker resolver to pass in Authorizer interface
2018-10-03 09:58:42 +02:00
Derek McGowan
a6198b7692
Update resolver code
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2018-09-28 14:32:23 -07:00
Samuel Karp
607888ce29 ctr: make kill use stop-signal by default
The OCI image specification includes a `StopSignal` field in the image
configuration, denoting the system call signal to be sent to the
container to exit.  This commit adds a new `WithImageStopSignal` container
option that can be used for storing the `StopSignal` field as a label on
the container.  This commit also adjusts `ctr run` to call
`WithImageStopSignal` and `ctr tasks kill` to send the signal stored in
that label by default.

Signed-off-by: Samuel Karp <skarp@amazon.com>
2018-09-27 15:53:38 -07:00
Samuel Karp
b392a3a8e4 signals: move ParseSignal to containerd package
Signed-off-by: Samuel Karp <skarp@amazon.com>
2018-09-27 15:53:38 -07:00
Lifubang
cb0eed833d decode Spec value in command 'ctr c info <containerid>'
Signed-off-by: Lifubang <lifubang@aliyun.com>

fix some errors

use typeurl.UnmarshalAny instead json.Unmarshal to interface{}

Signed-off-by: Lifubang <lifubang@aliyun.com>
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-09-27 10:44:54 -04:00
Michael Crosby
6496078ef8
Merge pull request #2669 from estesp/fix-withuser-comment
Remove a TODO from the code comments that is complete
2018-09-21 14:17:23 -04:00
Justin Terry (VM)
547bb94e4b Fix ctr run for Windows containers
1. Fixes bugs in ctr run that were introduced by 1d9b969
2. Adds support for the --isolated flag that runs Windows HyperV
cotainers instead of process isolated containers on Windows.

Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
2018-09-20 14:28:36 -07:00
Phil Estes
41615e8ded
Remove a TODO from the code comments that is complete
WithUser... helpers do support non-snapshot rootfs now.

Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com>
2018-09-20 09:07:36 -04:00
Derek McGowan
9faeea1e5e
Merge pull request #2649 from estesp/nonewpriv-flag
Add flag to ctr for running with "NoNewPrivileges: false"
2018-09-19 11:17:05 -07:00
Derek McGowan
a62be324b7
Unify docker and oci importer
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2018-09-17 14:41:43 -07:00
Derek McGowan
bce20b75da
Simplify docker importer
Support any layout and rely on manifest.json to reference blobs

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2018-09-14 14:21:27 -07:00
Derek McGowan
9e6db71954
Add docker importer
Update ctr to support all formats by default

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2018-09-14 14:21:26 -07:00
Derek McGowan
f57c5cdefb
Refactor image importer
Allow customization of reference creation.
Add option for digest references.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2018-09-14 14:21:26 -07:00
Phil Estes
c28ce39cea
Add flag to ctr for running with NoNewPrivileges: false
Add flag and With-helper to set NoNewPrivileges to false since it is on
by default in the default UNIX spec for containerd, but off by default
in Docker and CRI plugin use. This allows for easy testing with it off
for comparison.

Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com>
2018-09-14 11:03:58 -04:00
Michael Crosby
60d13d63c4 Add optional install path
This allows users to consume the install functionality but also install
to other areas instead of the managed `/opt` dir.

```bash
> ctr install --path /usr/local
```

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-09-11 10:36:00 -04:00
Michael Crosby
1597270d04
Merge pull request #2579 from lifubang/ctrrun
fix when --config provided, don't need Image/RootFS
2018-09-10 13:09:08 -04:00
Lifubang
48fe63511a code optimization after review
Signed-off-by: Lifubang <lifubang@acmcoder.com>
2018-09-05 23:36:31 +08:00
Justin Terry (VM)
c818a6b13d Merges the oci package for Linux and Windows
On Windows we need to be able to create both Linux and Windows OCI spec
files by default to support WCOW and LCOW scenarios. This merges the
compile time differences into runtime differences between the two based
on the spec and platform the user sets.

It maintains the old behavior with Default specs resulting in the
platform default the binary is compiled for.

Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
2018-08-30 09:46:04 -07:00
Michael Crosby
6b00aaaf20
Merge pull request #2573 from lifubang/relativepathforrootfs
support relative rootfs path in ctr
2018-08-27 10:25:25 -04:00
Phil Estes
68a5db67ad
Merge pull request #2582 from lifubang/startd
add -detach flag for 'ctr t start'
2018-08-27 22:23:31 +08:00
Lifubang
66f6dd8b3b add -detach flag for 'ctr t start'
Signed-off-by: Lifubang <lifubang@aliyun.com>
2018-08-27 18:43:56 +08:00
Derek McGowan
9edcfcc1cb
Add platform match comparer interface
Adds a new platform interface for matching and comparing platforms.
This new interface allows both filtering and ordering of platforms
to support running multiple platform and choosing the best platform.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2018-08-27 00:11:46 -07:00
Lifubang
1d9b96988f fix when --config provided, don't need Image/RootFS
Signed-off-by: Lifubang <lifubang@aliyun.com>
2018-08-27 11:18:25 +08:00
Lifubang
dc6ed04ff5 support relative rootfs path in ctr
Signed-off-by: Lifubang <lifubang@aliyun.com>
2018-08-24 07:56:37 +08:00
Phil Estes
830363acac
Merge pull request #2544 from kadisi/process_args
set args value of process if args is nil
2018-08-22 15:31:30 -04:00
Michael Crosby
4f644dbfd5 Copy io into and out of console
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-08-22 14:04:17 -04:00
kadisi
7dae56671d set args value of process if args is nil
Signed-off-by: kadisi <iamkadisi@163.com>
2018-08-21 09:44:50 +08:00
Michael Crosby
b67ea850af Add opt for default unix device permissions
These opts either inherit the parent cgroup device.list or append the
default unix devices like /dev/null /dev/random so that the container
has access.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-08-15 11:52:43 -04:00
Michael Crosby
3be457d7d6 Move content.Fetch configuration to struct
This makes it easier for callers to call this function and populate the
config without relying on specific flags across commands.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-08-09 10:26:31 -04:00
Phil Estes
2783a19b10
Merge pull request #2518 from crosbymichael/install
Add install support for binary images
2018-08-03 08:45:02 -04:00
Michael Crosby
5a47c5ec1d Add lib support as an option
Some images like `criu` will have extra libs that it requires.  This
adds lib support via LD_LIBRARY_PATH and InstallOpts

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-08-02 17:11:29 -04:00
Evan Hazlett
1537f31381 Add install support for binary images
This adds a way for users to programatically install containerd binary
dependencies.

With runtime v2 and new shim's being built, it will be a challenge to
get those onto machines.  Users would have to find the link, download,
place it in their path, yada yada yada.

With this functionality of a managed `/opt` directory, containerd can
use existing image and distribution infra. to get binarys, shims, etc
onto the system.

Configuration:

*default:* `/opt/containerd`

*containerd config:*
```toml
[plugins.opt]
	path = "/opt/mypath"

```

Usage:

*code:*

```go
image, err := client.Pull(ctx, "docker.io/crosbymichael/runc:latest")
client.Install(ctx, image)
```

*ctr:*

```bash
ctr content fetch docker.io/crosbymichael/runc:latest
ctr install docker.io/crosbymichael/runc:latest
```

You can manage versions and see what is running via standard image
commands.

Images:

These images MUST be small and only contain binaries.

```Dockerfile
FROM scratch
Add runc /bin/runc
```

Containerd will only extract files in `/bin` of the image.

Later on, we can add support for `/lib`.

The code adds a service to manage an `/opt/containerd` directory and
provide that path to callers via the introspection service.

How to Test:

Delete runc from your system.

```bash
> sudo ctr run --rm  docker.io/library/redis:alpine redis
ctr: OCI runtime create failed: unable to retrieve OCI runtime error (open /run/containerd/io.containerd.runtime.v1.linux/default/redis/log.json: no such file or directory): exec: "runc": executable file not found in $PATH: unknown

> sudo ctr content fetch docker.io/crosbymichael/runc:latest
> sudo ctr  install docker.io/crosbymichael/runc:latest

> sudo ctr run --rm  docker.io/library/redis:alpine redis
1:C 01 Aug 15:59:52.864 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
1:C 01 Aug 15:59:52.864 # Redis version=4.0.10, bits=64, commit=00000000, modified=0, pid=1, just started
1:C 01 Aug 15:59:52.864 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
1:M 01 Aug 15:59:52.866 # You requested maxclients of 10000 requiring at least 10032 max file descriptors.
1:M 01 Aug 15:59:52.866 # Server can't set maximum open files to 10032 because of OS error: Operation not permitted.
1:M 01 Aug 15:59:52.866 # Current maximum open files is 1024. maxclients has been reduced to 992 to compensate for low ulimit. If you need higher maxclients increase 'ulimit -n'.
1:M 01 Aug 15:59:52.870 * Running mode=standalone, port=6379.
1:M 01 Aug 15:59:52.870 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
1:M 01 Aug 15:59:52.870 # Server initialized
1:M 01 Aug 15:59:52.870 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
1:M 01 Aug 15:59:52.870 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
1:M 01 Aug 15:59:52.870 * Ready to accept connections
^C1:signal-handler (1533139193) Received SIGINT scheduling shutdown...
1:M 01 Aug 15:59:53.472 # User requested shutdown...
1:M 01 Aug 15:59:53.472 * Saving the final RDB snapshot before exiting.
1:M 01 Aug 15:59:53.484 * DB saved on disk
1:M 01 Aug 15:59:53.484 # Redis is now ready to exit, bye bye...
```

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-08-02 17:11:29 -04:00
Samuel Karp
9665a2650a *: replace 3600 seconds with 1 hour
Signed-off-by: Samuel Karp <skarp@amazon.com>
2018-08-02 11:40:03 -07:00
Justin Terry (VM)
790c3a3663 Remove extra allocation in NewTask
Reorders the code so that it doesnt overwrite the previous allocation
when creating a NewTask via ctr.exe

Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
2018-08-01 13:22:18 -07:00
Phil Estes
ed0e73422d
Merge pull request #2468 from dmcgowan/set-platform-on-unpack
Update client Image to have configurable platform
2018-07-31 11:56:09 -04:00
Phil Estes
4249f44d81
Merge pull request #2493 from dmcgowan/sync-lease-removal
Add sync option to lease removal
2018-07-31 11:31:55 -04:00
Stephen Day
920dc79b4d
Merge pull request #2504 from samuelkarp/ctr-t-metrics
ctr: add new metrics subcommand
2018-07-30 13:07:19 -07:00
Samuel Karp
9a34bb046a metrics: add optional json output
Signed-off-by: Samuel Karp <skarp@amazon.com>
2018-07-27 15:21:08 -07:00
Stephen Day
2a1bd7414b
oci: introduce WithSpecFromFile combinator
We introduce a WithSpecFromFile option combinator to allow creation
simpler creation of OCI specs from a file name. Often used as the first
option in a `SpecOpts` slice, it simplifies choosing between a local
file and the built-in default.

The code in `ctr run` has been updated to use the new option, with out
changing the order of operations or functionality present there.

Signed-off-by: Stephen Day <stephen.day@getcruise.com>
2018-07-27 14:25:42 -07:00
Samuel Karp
2c87d120df ctr: add new metrics subcommand
Signed-off-by: Samuel Karp <skarp@amazon.com>
2018-07-27 09:37:57 -07:00
Michael Crosby
26e2dd6754
Merge pull request #2425 from avagin/docker-fixes
task: allow to specify namespaces which are restored externally
2018-07-25 10:26:08 -04:00
Michael Crosby
0d52c71c80
Merge pull request #2474 from dmcgowan/lease-expiration
Improved lease management
2018-07-20 16:54:17 -04:00
Andrei Vagin
fc2fcf6b2a task: WithExit() doesn't have to overwrite existing options
Signed-off-by: Andrei Vagin <avagin@openvz.org>
2018-07-20 13:19:05 -07:00
Michael Crosby
17ab11a236 Fixes for runtimev2 and checkpoint restore
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-07-20 12:09:29 -04:00
Derek McGowan
94e132fd07
Add sync option on lease removal
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2018-07-19 14:37:55 -07:00
Derek McGowan
00a99c0472
Add leases subcommand in ctr
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2018-07-18 10:43:37 -07:00
Derek McGowan
3a916a0f67
Update client Image to have configurable platform
Separate Fetch and Pull commands in client to distinguish
between platform specific and non-platform specific operations.
`ctr images pull` with all platforms will now unpack all platforms.
`ctr content fetch` now supports platform flags.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2018-07-17 15:43:03 -07:00
Michael Crosby
da1b5470cd Runtime v2
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-07-17 10:21:29 -04:00
Danail Branekov
3cf3881fa4 Introduce plugins/list subcommand
`Ctr` interface follows the pattern `ctr <command> <subcommand>` except
for the `plugins` command which does not have subcommands. This feels
unnatural to certain users and they would expect that they can list
containerd plugins via `ctr plugins list`.

This commit implements their expectation so that `plugins` becomes a
command "group" and its `list` subcommand actually lists the plugins.

Signed-off-by: Danail Branekov <danailster@gmail.com>
2018-07-02 10:20:20 +03:00
Michael Crosby
08150bfe76 Update ttrpc for containerd repo
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-06-28 09:53:40 -04:00
Michael Crosby
ca204317ed
Merge pull request #2422 from crosbymichael/ctr-delete
Add cio.Load for loading io set
2018-06-27 08:46:18 -04:00
Michael Crosby
fdceb13b14 Add cio.Load for loading io set
This adds a `Load` Opt for cio to load a tasks io/fifos without
attaching or starting the copy routines.

It adds the load method in `ctr` by default so that fifos or other IO
are removed from disk on delete methods inbetween command runs.  It is
not the default for all task loads for backwards compat. and a user may
want to keep io around to reuse or if log files are used.

Fixes #2421

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-06-26 11:48:26 -04:00
Felix Abecassis
5dd22a20af Move ContainerFlags to "commands" package
Commit 05513284e7 exposed the "rootfs"
and "no-pivot" flags for the "containers" command, but it accidentally
removed them for "run" since package-level variables are initialized
before package-level init functions in golang. Hoisting these flags to
a package imported by both commands solves the problem.

Signed-off-by: Felix Abecassis <fabecassis@nvidia.com>
2018-06-20 18:33:59 -07:00
Phil Estes
df34eefa12
Merge pull request #2330 from crosbymichael/hpc
Add nvidia gpu support
2018-06-07 10:10:20 -04:00
Evan Hazlett
821c8eaa91
runtime/linux/shim -> runtime/shim
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
2018-06-06 14:35:06 -04:00
Akihiro Suda
d88de4a34f content: change Writer/ReaderAt to take OCI
This change allows implementations to resolve the location of the actual data
using OCI descriptor fields such as MediaType.

No OCI descriptor field is written to the store.

No change on gRPC API.

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2018-06-01 11:51:43 +09:00
Evan Hazlett
cae94b930d linux -> runtime/linux
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
2018-05-30 09:23:10 -04:00
Michael Crosby
ae4b78d1cc Move progress into pkg
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-05-22 13:32:25 -04:00
Michael Crosby
b949697a9c Add nvidia gpu support via libnvidia-container
This adds nvidia gpu support via the libnvidia-container project and
`nvidia-container-cli`.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-05-09 13:37:39 -04:00
Derek McGowan
f701b3b960
Fix race in ctr pull
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2018-05-07 10:29:24 -07:00
Michael Crosby
e22c827cf5
Merge pull request #2323 from stevvooe/ping-snapshots-from-cli
cmd/snapshots: add gc.root to created snapshots
2018-05-04 13:27:44 -04:00
Tom Godkin
fc8bce59b9 Use user-specific temp directory if set
This allows non-privileged users to use containerd. This is part of a
larger track of work integrating containerd into Cloudfoundry's garden
with support for rootless.

[#156343575]

Signed-off-by: Claudia Beresford <cberesford@pivotal.io>
2018-05-04 10:27:58 +01:00
Stephen J Day
ed72059fac
cmd/snapshots: add gc.root to created snapshots
This adds gc.root label to snapshots created with prepare and commit via
the CLI. WIthout this, created snapshots get immediately garbage
collected. There may be a better solution but this seems to be a solid
stop gap.

We may also need to add more functionality around snapshot labeling for
the CLI but current use cases are unclear.

Signed-off-by: Stephen J Day <stevvooe@gmail.com>
2018-05-03 07:09:38 +02:00
Andrei Vagin
60daa414db Allow to checkpoint and restore a container with console
runc already supports this case, so we just need to run it with proper
options.

Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-04-28 01:06:42 +03:00
Derek McGowan
1a5e0df98f
Merge pull request #2305 from kolyshkin/context
Switch from x/net/context -> context
2018-04-25 10:44:22 -07:00
Michael Crosby
090687916d Correctly handle reading from events channel
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-04-25 11:21:22 -04:00
Kir Kolyshkin
bbe14f0a2e Switch from x/net/context to context
Since Go 1.7, context is a standard package, superceding the
"x/net/context". Since Go 1.9, the latter only provides a few type
aliases from the former. Therefore, it makes sense to switch to the
standard package.

This commit was generated by the following script (with a couple of
minor fixups to remove extra changes done by goimports):

	#!/bin/bash

	if [ $# -ge 1 ]; then
		FILES=$*
	else
		FILES=$(git ls-files \*.go | grep -vF ".pb.go" | grep -v
	^vendor/)
	fi

	for f in $FILES; do
		printf .
		sed -i -e 's|"golang.org/x/net/context"$|"context"|' $f
		goimports -w $f
		awk '	/^$/ {e=1; next;}
			/[[:space:]]"context"$/ {e=0;}
			{if (e) {print ""; e=0}; print;}' < $f > $f.new && \
				mv $f.new $f
		goimports -w $f
	done
	echo

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-04-24 14:33:34 -07:00
Julien Kassar
9d247718d7 Update ctr tasks list usage for quiet flag
Signed-off-by: Julien Kassar <github@kassisol.com>
2018-04-23 14:53:35 -04:00
Fernando Mayo
0a26b0fe43 ctr: fix --mount help message
Signed-off-by: Fernando Mayo <fermayo@gmail.com>
2018-04-17 18:29:33 -07:00
Justin Cormack
903191072e
Add --privileged option to ctr run
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2018-04-04 13:25:42 +01:00
Derek McGowan
43d0a5cb60
Pass in context to lease done function in client
Allows the client to choose the context to finish the lease.
This allows the client to switch contexts when the main context
used to the create the lease may have been cancelled.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2018-03-22 14:09:24 -07:00
Derek McGowan
a0b818e093
Merge pull request #2200 from jessvalarezo/multiarch-pulls
allow content to be pulled for specific platform(s), all platforms
2018-03-14 14:46:30 -07:00
Jess Valarezo
e343006b8f ctr: allow for force kill when deleting task process
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2018-03-13 14:58:31 -07:00
Stephen J Day
ae11d8c64b
cmd/ctr/images: add i alias for images command
Signed-off-by: Stephen J Day <stephen.day@docker.com>
2018-03-12 17:42:41 -07:00
Jess Valarezo
c3cf3d7822 allow content to be pulled for specific platform(s), all platforms
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2018-03-12 17:31:42 -07:00
Stephen Day
3013762fc5
Merge pull request #2203 from Random-Liu/support-in-process-integration
Support in process integration
2018-03-12 14:38:27 -07:00
Lantao Liu
1128b3d664 Add service plugin and support in process integration.
Signed-off-by: Lantao Liu <lantaol@google.com>
2018-03-12 18:03:50 +00:00
Stephen Day
5368984859
Merge pull request #2160 from ijc/ctr-run-unpack
ctr: unpack the image on run if necessary
2018-03-06 19:29:43 -08:00
Derek McGowan
2b6b99b4a1
Merge pull request #2184 from kunalkushwaha/oci-error
better image config parse error.
2018-03-05 10:29:02 -08:00
Akihiro Suda
05513284e7 ctr: add UNIX-specific flags to ctr c create
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2018-03-05 15:26:03 +09:00
Kunal Kushwaha
6ed4e9e106 better image config parse error.
compatible oci runtime version printed with parse error

Signed-off-by: Kunal Kushwaha <kushwaha_kunal_v7@lab.ntt.co.jp>
2018-03-05 14:04:08 +09:00
Ian Campbell
f48cc7d7fe ctr: unpack the image on run if necessary
Without this `ctr run` can fail with:

    ctr: parent snapshot sha256:70798fd80095f40b41baa5d107fb61532bfe494d96313fea01e8fcbf4e8743ee does not exist: not found

My image was produced by buildkit, which doesn't unpack (I think this makes
sense since buildkit doesn't know if I am going to run the image or export/push
it etc).

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2018-02-26 14:23:28 +00:00
Michael Crosby
d3a8055e2d Add --pid-file to ctr
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-02-20 15:10:50 -05:00
Kunal Kushwaha
b12c3215a0 Licence header added
Signed-off-by: Kunal Kushwaha <kushwaha_kunal_v7@lab.ntt.co.jp>
2018-02-19 10:32:26 +09:00
Phil Estes
e4e53bf486
Add --with-ns flag to ctr run/create
Adds a useful flag to `ctr` to enable joining any existing Linux
namespaces for any namespace types (network, pid, ipc, etc.) using the
existing With helper in the oci package.

Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com>
2018-02-16 15:23:04 -05:00
Michael Crosby
78bd07afef
Merge pull request #1746 from AkihiroSuda/split-differ-interface
diff: resplit Applier from Differ
2018-02-05 09:18:56 -05:00
Michael Crosby
5f89502a24
Merge pull request #1790 from jessvalarezo/ctr-c-create
ctr: add container create cmd and config flag
2018-01-29 17:19:14 -05:00
Derek McGowan
b763777288
diff: rename differ to comparer
Remove combined interface and split implementations.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2018-01-26 16:32:09 -08:00
Phil Estes
d4fb0709c9
Add error return for missing params in ctr images
For missing required parameters adds error return before attempting any
actions to `ctr images` commands.

Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com>
2018-01-26 09:14:13 -05:00
Jess Valarezo
2c9ce2e693 ctr: add container create, config flag for spec
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2018-01-25 17:16:13 -08:00
Darren Stahl
dcff993653 Update Windows runtime to use snapshotter and differ layers
This changes the Windows runtime to use the snapshotter and differ
created layers, and updates the ctr commands to use the snapshotter and differ.

Signed-off-by: Darren Stahl <darst@microsoft.com>
2018-01-23 14:40:24 -08:00
Phil Estes
d7efcbc083
Merge pull request #2036 from stevvooe/use-buffer-pools
archive, cio, cmd, linux: use buffer pools
2018-01-23 15:00:41 -05:00
Phil Estes
dc5964ccc2
Merge pull request #2037 from pauldotknopf/master
Made a public method to set environment variables and mounts for containers.
2018-01-22 17:05:26 -05:00
Stephen J Day
cd72819b53
archive, cio, cmd, linux: use buffer pools
To avoid buffer bloat in long running processes, we try to use buffer
pools where possible. This is meant to address shim memory usage issues,
but may not be the root cause.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2018-01-22 13:52:06 -08:00
Paul Knopf
b4c3cd7640
Add WithEnv and WithMount oci options
Signed-off-by: Paul Knopf <pauldotknopf@gmail.com>
2018-01-22 16:35:31 -05:00
Akihiro Suda
507a149488 cio: add WithFIFODir opt
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2018-01-18 14:33:56 +09:00
Akihiro Suda
1167035be3 ctr: promote cOpts over opts, as oci.WithImageConfig requires snapshot
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2018-01-11 14:04:11 +09:00
Daniel Nephin
184bc25629 Add unconvert linter
This linter checks for unnecessary type convertions.

Some convertions are whitelisted because their type is different
on 32bit platforms

Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2018-01-09 17:36:44 -05:00
Kenfe-Mickael Laventure
0cc79a6ff6
Add no-pivot flag to ctr
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2018-01-09 07:48:30 -08:00
Michael Crosby
4e755ad383
Merge pull request #1947 from jessvalarezo/ctr-snapshot-diff
ctr: snapshots diff command
2018-01-03 11:34:29 -05:00
Jess Valarezo
625eb5e661 ctr: snapshots diff command
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2018-01-02 21:18:12 -05:00
Michael Crosby
399e3c57c3 Change ctr help for mount from dest to dst
dest is not valid, only destination and dst

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-12-15 16:40:25 -05:00
Phil Estes
afbbe43745
Merge pull request #1895 from dnephin/refactor-cio
Refactor cio package
2017-12-15 14:44:44 -05:00
Stephen J Day
9aeeefae55
cmd/ctr: stablize output of snapshot tree
Preserves the order of the tree output between each execution. Slightly
refactored the behavior to be more "object oriented".

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-12-12 14:50:05 -08:00
Daniel Nephin
7d4337e738 Reduce the number of IO constructors
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2017-12-11 15:07:09 -05:00
Derek McGowan
40c67fdf78
Merge pull request #1880 from AkihiroSuda/refactor-importer
importer: refactor and fix GC
2017-12-04 20:56:26 -08:00
Akihiro Suda
63401970c7 importer: refactor
- Use lease API (previoisly, GC was not supported)
- Refactored interfaces for ease of future Docker v1 importer support

For usage, please refer to `ctr images import --help`.

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-12-05 12:48:32 +09:00
Stephen J Day
1710fe9b95
cmd/ctr: move log messages to debug
Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-12-01 13:57:54 -08:00
Jess Valarezo
9885edfc44 rename snapshot->snapshots pkg
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2017-11-29 14:55:02 -08:00
Jess Valarezo
61c8fe2307 ctr: snapshot->snapshots cmd, add aliases
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2017-11-29 14:34:02 -08:00
Akihiro Suda
7f95b9f987 ctr: add EnvVar CONTAINERD_SNAPSHOTTER for --snapshotter
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-11-29 19:11:10 +09:00
Phil Estes
2556c594ec
Merge pull request #1767 from stevvooe/ttrpc-shim
linux/shim: reduce memory overhead by using ttrpc
2017-11-28 12:43:41 -05:00
Stephen Day
372cdfac3b
Merge pull request #1638 from dmcgowan/gc-policy
gc: add policy plugin
2017-11-27 18:20:10 -08:00
Daniel Nephin
cdf62f69a1 Fix usage of oci in other packages.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2017-11-27 16:16:17 -05:00
Daniel Nephin
0103d14b47 Fix ctr events
add import to register event types with grpc

Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2017-11-24 14:28:44 -05:00
Stephen J Day
e8f52c35ce
linux/shim: reduce memory overhead by using ttrpc
By replacing grpc with ttrpc, we can reduce total memory runtime
requirements and binary size. With minimal code changes, the shim can
now be controlled by the much lightweight protocol, reducing the total
memory required per container.

When reviewing this change, take particular notice of the generated shim
code.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-11-22 12:21:48 -08:00
Daniel Nephin
f74862a0dd Add structcheck, unused, and varcheck linters.
Warn on unused and dead code

Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2017-11-21 11:14:37 -05:00
Derek McGowan
3f1a61f76a
Add synchronous image delete
Synchronous image delete provides an option image delete to wait
until the next garbage collection deletes after an image is removed
before returning success to the caller.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-11-20 17:08:35 -08:00
Daniel Nephin
298dabc6c2 Move io.go into cio package
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2017-11-17 17:04:45 -05:00
Stephen J Day
c5022ad92d
protobuf: use the gogo/types package for empty
Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-11-15 19:08:54 -08:00
Stephen Day
571c002ef6
Merge pull request #1755 from AkihiroSuda/fix-ctr-snapshot-args
ctr: fix args
2017-11-14 17:55:14 -08:00
Akihiro Suda
5eff92d1ba ctr: fix args
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-11-15 01:34:12 +00:00
Stephen Day
f9933e9f96
Merge pull request #1742 from jessvalarezo/ctr-task-kill
ctr: update task kill to take exec-id
2017-11-13 13:53:26 -08:00
Michael Crosby
92ca22c997
Merge pull request #1735 from estesp/image-rm-feedback
Fix output on ctr images rm to show actual feedback
2017-11-13 14:18:12 -05:00
Jess Valarezo
1966f9f1b7 ctr: update task kill to take exec-id
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2017-11-13 10:47:15 -08:00
Phil Estes
08760757ed
Fix output on ctr images rm to show actual feedback
Currently the output for a non-existent image reference and a valid
image reference is exactly the same on `ctr images remove`. Instead of
outputting the target ref input, if it is "not found" we should alert
the user in case of a mispelling, but continue not to make it a failure
for the command (given it supports multiple ref entries)

Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com>
2017-11-10 15:21:27 -05:00
Jess Valarezo
807f4d2ec7 expose exec-id on ctr task ps
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2017-11-10 11:38:51 -08:00
Victor Vieux
f8a536ed6a Add S to PLATFORM in images & plugins list
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2017-11-08 10:43:12 -08:00
Sebastiaan van Stijn
65d5b8b937
Align version output and minor code cleanup
This patch changes the output of `ctr version` to align version and revision.
It also changes `.Printf()` to `.Println()`, to make the code slightly easier
to read.

Before this change:

    $ ctr version
    Client:
      Version: v1.0.0-beta.2-132-g564600e.m
      Revision: 564600ee79aefb0f24cbcecc90d4388bd0ea59de.m

    Server:
      Version: v1.0.0-beta.2-132-g564600e.m
      Revision: 564600ee79aefb0f24cbcecc90d4388bd0ea59de.m

With this patch applied:

    $ ctr version
    Client:
      Version:  v1.0.0-beta.2-132-g564600e.m
      Revision: 564600ee79aefb0f24cbcecc90d4388bd0ea59de.m

    Server:
      Version:  v1.0.0-beta.2-132-g564600e.m
      Revision: 564600ee79aefb0f24cbcecc90d4388bd0ea59de.m

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-11-03 17:49:23 +01:00
Stephen J Day
0a1a13448b
defaults: add package to contain server defaults
To reduce the binary size of containerd, we no longer import the
`server` package for only a few defaults. This reduces the size of `ctr`
by 2MB. There are probably other gains elsewhere.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-11-02 13:59:34 -07:00
Jess Valarezo
864b16a2cb ctr: alphabetize commands, rename signals
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2017-10-31 11:57:49 -07:00
Jess Valarezo
f654b7b71e ctr: move pprof to commands package
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2017-10-31 11:57:49 -07:00
Jess Valarezo
a827a17f1d ctr: move shim to commands
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2017-10-31 11:57:49 -07:00
Jess Valarezo
c3b70f1d0b ctr: move tasks, run to commands package
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2017-10-31 11:57:41 -07:00
Phil Estes
ff904841f9
Merge pull request #1668 from jessvalarezo/image-unpack-check
client: Add helper function which checks if an image is unpacked
2017-10-31 10:23:08 -04:00
Jess Valarezo
1552ee23da client: Add helper function which checks if an image is unpacked
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2017-10-30 16:33:54 -07:00
Jess Valarezo
e4da49c44c ctr: move unpack to snapshot command
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2017-10-30 13:23:36 -07:00
Jess Valarezo
456d3f4475 ctr: move push and pull to images command
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2017-10-30 13:23:36 -07:00
Jess Valarezo
b58e4fc2ed ctr: move fetch,fetch-object,push-object to content
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2017-10-30 13:23:06 -07:00
Jess Valarezo
16855eedf7 ctr: move resolver to commands package
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2017-10-26 16:31:58 -04:00
Jess Valarezo
ffd0d2ef58 ctr: move signals to commands package
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2017-10-26 16:31:23 -04:00
Jess Valarezo
8540587b37 ctr: move events command
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2017-10-25 22:21:57 -04:00
Jess Valarezo
fdb6859921 ctr: move namespaces command
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2017-10-25 22:00:14 -04:00
Jess Valarezo
750fd89b38 ctr: move snapshot command
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2017-10-25 21:23:41 -04:00
Jess Valarezo
0895dbe932 ctr: move content command
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2017-10-25 21:16:44 -04:00
Jess Valarezo
f980cc197e ctr: move images command
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2017-10-25 21:08:00 -04:00
Jess Valarezo
47fae4dd17 ctr: move containers command
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2017-10-25 21:07:54 -04:00
Michael Crosby
ae995bc7b3 Move plugins command
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-10-25 11:22:59 -04:00
Michael Crosby
2dac1b6963 Move version command into package
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-10-25 11:14:09 -04:00
Michael Crosby
4743f1fc4c Move NewClient and AppContext to commands pkg
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-10-25 11:10:00 -04:00
Jess Valarezo
a19a20303a ctr: add commands package with shared utility functions
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2017-10-23 17:40:18 -07:00