summaryrefslogtreecommitdiff
path: root/runconfig
Commit message (Collapse)AuthorAgeFilesLines
* hostconfig: move unit tests to api/types/containerSebastiaan van Stijn2022-12-271-190/+0
| | | | | | | | These types were moved to api/types/container in 7ac4232e70fe7cf7318333cd0890db7f95663079, but the unit-tests for them were not moved. This patch moves the unit-tests back together with the types. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* runconfig/opts: use strings.Cut()Sebastiaan van Stijn2022-12-211-6/+2
| | | | Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* runconfig, oci, image, layer, distribution: fix empty-lines (revive)Sebastiaan van Stijn2022-09-281-2/+0
| | | | | | | | | | | | | | | | | | | | | | | runconfig/config_test.go:23:46: empty-lines: extra empty line at the start of a block (revive) runconfig/config_test.go:75:55: empty-lines: extra empty line at the start of a block (revive) oci/devices_linux.go:57:34: empty-lines: extra empty line at the start of a block (revive) oci/devices_linux.go:60:69: empty-lines: extra empty line at the start of a block (revive) image/fs_test.go:53:38: empty-lines: extra empty line at the end of a block (revive) image/tarexport/save.go:88:29: empty-lines: extra empty line at the end of a block (revive) layer/layer_unix_test.go:21:34: empty-lines: extra empty line at the end of a block (revive) distribution/xfer/download.go:302:9: empty-lines: extra empty line at the end of a block (revive) distribution/manifest_test.go:154:99: empty-lines: extra empty line at the end of a block (revive) distribution/manifest_test.go:329:52: empty-lines: extra empty line at the end of a block (revive) distribution/manifest_test.go:354:59: empty-lines: extra empty line at the end of a block (revive) registry/config_test.go:323:42: empty-lines: extra empty line at the end of a block (revive) registry/config_test.go:350:33: empty-lines: extra empty line at the end of a block (revive) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* runconfig: ContainerDecoder(): fix handling of invalid JSONSebastiaan van Stijn2022-04-113-20/+37
| | | | | | | | Implement similar logic as is used in httputils.ReadJSON(). Before this patch, endpoints using the ContainerDecoder would incorrectly return a 500 (internal server error) status. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* Merge pull request #42725 from thaJeztah/runconfig_simplifyAkihiro Suda2021-10-275-95/+22
|\ | | | | runconfig: decodeContainerConfig() return early if there's no HostConfig
| * runconfig: decodeContainerConfig() return early if there's no HostConfigSebastiaan van Stijn2021-08-095-95/+22
| | | | | | | | | | | | | | | | Each of the validation functions depended on HostConfig being not `nil`. Use an early return, instead of continuing, and checking if it's `nil` in each of the validate functions. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* | refactor: move from io/ioutil to io and os packageEng Zer Jun2021-08-272-4/+4
| | | | | | | | | | | | | | | | The io/ioutil package has been deprecated in Go 1.16. This commit replaces the existing io/ioutil functions with their new definitions in io and os packages. Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
* | Update to Go 1.17.0, and gofmt with Go 1.17Sebastiaan van Stijn2021-08-244-0/+4
|/ | | | Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* pkg/sysinfo.New(), daemon.RawSysInfo(): remove "quiet" argumentSebastiaan van Stijn2021-07-142-3/+3
| | | | | | | | | | | | The "quiet" argument was only used in a single place (at daemon startup), and every other use had to pass "false" to prevent this function from logging warnings. Now that SysInfo contains the warnings that occurred when collecting the system information, we can make leave it up to the caller to use those warnings (and log them if wanted). Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* pkg/sysinfo: rm duplicatesKir Kolyshkin2020-06-262-38/+28
| | | | | | | | | | | | The CPU CFS cgroup-aware scheduler is one single kernel feature, not two, so it does not make sense to have two separate booleans (CPUCfsQuota and CPUCfsPeriod). Merge these into CPUCfs. Same for CPU realtime. For compatibility reasons, /info stays the same for now. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
* cgroup2: implement `docker info`Akihiro Suda2020-04-172-6/+16
| | | | | | ref: https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
* fix goimportsAkihiro Suda2020-02-111-8/+8
| | | | Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
* bump gotest.tools v3.0.1 for compatibility with Go 1.14Sebastiaan van Stijn2020-02-111-10/+10
| | | | | | full diff: https://github.com/gotestyourself/gotest.tools/compare/v2.3.0...v3.0.1 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* runconfig/config_test.go: remove unused test-utilitiesSebastiaan van Stijn2019-09-181-56/+0
| | | | | | The tests using these functions were removed in e89b6e8c2d2c36c43f22aeaf2a885646c2994051 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* Make cgroup namespaces configurableRob Gulewich2019-05-071-0/+26
| | | | | | | | | | | | | | This adds both a daemon-wide flag and a container creation property: - Set the `CgroupnsMode: "host|private"` HostConfig property at container creation time to control what cgroup namespace the container is created in - Set the `--default-cgroupns-mode=host|private` daemon flag to control what cgroup namespace containers are created in by default - Set the default if the daemon flag is unset to "host", for backward compatibility - Default to CgroupnsMode: "host" for client versions < 1.40 Signed-off-by: Rob Gulewich <rgulewich@netflix.com>
* Format code with gofmt -s from go-1.11beta1Kir Kolyshkin2018-09-061-8/+8
| | | | | | | | | | | | | | This should eliminate a bunch of new (go-1.11 related) validation errors telling that the code is not formatted with `gofmt -s`. No functional change, just whitespace (i.e. `git show --ignore-space-change` shows nothing). Patch generated with: > git ls-files | grep -v ^vendor/ | grep .go$ | xargs gofmt -s -w Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
* Update tests to use gotest.tools 👼Vincent Demeester2018-06-132-4/+4
| | | | Signed-off-by: Vincent Demeester <vincent@sbr.pm>
* Automated migration usingDaniel Nephin2018-03-162-16/+17
| | | | | | gty-migrate-from-testify --ignore-build-tags Signed-off-by: Daniel Nephin <dnephin@docker.com>
* Add canonical import commentDaniel Nephin2018-02-0511-11/+11
| | | | Signed-off-by: Daniel Nephin <dnephin@docker.com>
* Remove solaris build tag and `contrib/mkimage/solarisYong Tang2017-11-021-1/+1
| | | | Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
* Remove solaris filesMichael Crosby2017-10-242-51/+0
| | | | | | For obvious reasons that it is not really supported now. Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
* Volume refactoring for LCOWSimon Ferquel2017-09-142-210/+0
| | | | Signed-off-by: Simon Ferquel <simon.ferquel@docker.com>
* Add gosimple linterDaniel Nephin2017-09-122-4/+2
| | | | | | Update gometalinter Signed-off-by: Daniel Nephin <dnephin@docker.com>
* Add decodeContainerConfig test removed from docker/cliDaniel Nephin2017-08-292-10/+241
| | | | Signed-off-by: Daniel Nephin <dnephin@docker.com>
* Remove string checking in API error handlingBrian Goff2017-08-155-33/+44
| | | | | | | | | | | | | | Use strongly typed errors to set HTTP status codes. Error interfaces are defined in the api/errors package and errors returned from controllers are checked against these interfaces. Errors can be wraeped in a pkg/errors.Causer, as long as somewhere in the line of causes one of the interfaces is implemented. The special error interfaces take precedence over Causer, meaning if both Causer and one of the new error interfaces are implemented, the Causer is not traversed. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
* Implement none, private, and shareable ipc modesKir Kolyshkin2017-08-141-35/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since the commit d88fe447df0e8 ("Add support for sharing /dev/shm/ and /dev/mqueue between containers") container's /dev/shm is mounted on the host first, then bind-mounted inside the container. This is done that way in order to be able to share this container's IPC namespace (and the /dev/shm mount point) with another container. Unfortunately, this functionality breaks container checkpoint/restore (even if IPC is not shared). Since /dev/shm is an external mount, its contents is not saved by `criu checkpoint`, and so upon restore any application that tries to access data under /dev/shm is severily disappointed (which usually results in a fatal crash). This commit solves the issue by introducing new IPC modes for containers (in addition to 'host' and 'container:ID'). The new modes are: - 'shareable': enables sharing this container's IPC with others (this used to be the implicit default); - 'private': disables sharing this container's IPC. In 'private' mode, container's /dev/shm is truly mounted inside the container, without any bind-mounting from the host, which solves the issue. While at it, let's also implement 'none' mode. The motivation, as eloquently put by Justin Cormack, is: > I wondered a while back about having a none shm mode, as currently it is > not possible to have a totally unwriteable container as there is always > a /dev/shm writeable mount. It is a bit of a niche case (and clearly > should never be allowed to be daemon default) but it would be trivial to > add now so maybe we should... ...so here's yet yet another mode: - 'none': no /dev/shm mount inside the container (though it still has its own private IPC namespace). Now, to ultimately solve the abovementioned checkpoint/restore issue, we'd need to make 'private' the default mode, but unfortunately it breaks the backward compatibility. So, let's make the default container IPC mode per-daemon configurable (with the built-in default set to 'shareable' for now). The default can be changed either via a daemon CLI option (--default-shm-mode) or a daemon.json configuration file parameter of the same name. Note one can only set either 'shareable' or 'private' IPC modes as a daemon default (i.e. in this context 'host', 'container', or 'none' do not make much sense). Some other changes this patch introduces are: 1. A mount for /dev/shm is added to default OCI Linux spec. 2. IpcMode.Valid() is simplified to remove duplicated code that parsed 'container:ID' form. Note the old version used to check that ID does not contain a semicolon -- this is no longer the case (tests are modified accordingly). The motivation is we should either do a proper check for container ID validity, or don't check it at all (since it is checked in other places anyway). I chose the latter. 3. IpcMode.Container() is modified to not return container ID if the mode value does not start with "container:", unifying the check to be the same as in IpcMode.IsContainer(). 3. IPC mode unit tests (runconfig/hostconfig_test.go) are modified to add checks for newly added values. [v2: addressed review at https://github.com/moby/moby/pull/34087#pullrequestreview-51345997] [v3: addressed review at https://github.com/moby/moby/pull/34087#pullrequestreview-53902833] [v4: addressed the case of upgrading from older daemon, in this case container.HostConfig.IpcMode is unset and this is valid] [v5: document old and new IpcMode values in api/swagger.yaml] [v6: add the 'none' mode, changelog entry to docs/api/version-history.md] Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
* gofmt: 5 filesJosh Soref2017-07-031-5/+5
| | | | | | | | | gofmt from go1.8.3 hg locate '*.go' |xargs ~/go/bin/gofmt -s -w Signed-off-by: Josh Soref <jsoref@gmail.com> Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* Remove some more `opts` from runconfig (not used anymore)Vincent Demeester2017-06-033-289/+0
| | | | Signed-off-by: Vincent Demeester <vincent@sbr.pm>
* Stop referring CLI flags in error messages if API client is unknownStanislav Bondarenko2017-05-225-18/+18
| | | | Signed-off-by: Stanislav Bondarenko <stanislav.bondarenko@gmail.com>
* Windows: Block read-onlyJohn Howard2017-05-083-0/+22
| | | | Signed-off-by: John Howard <jhoward@microsoft.com>
* Allow user to modify ingress networkAlessandro Boch2017-03-261-1/+1
| | | | Signed-off-by: Alessandro Boch <aboch@docker.com>
* fixed:go vetting warning unkeyed fieldsliker121342017-03-201-5/+5
| | | | Signed-off-by: Aaron.L.Xu <liker.xu@foxmail.com>
* Windows: Balk on --privilegedJohn Howard (VM)2017-03-137-34/+78
| | | | Signed-off-by: John Howard (VM) <jhoward@ntdev.microsoft.com>
* (*) Support --net:container:<containername/id> for windowsMadhan Raj Mookkandy2017-02-283-36/+58
| | | | | | | (*) (vdemeester) Removed duplicate code across Windows and Unix wrt Net:Containers (*) Return unsupported error for network sharing for hyperv isolation containers Signed-off-by: Madhan Raj Mookkandy <MadhanRaj.Mookkandy@microsoft.com>
* Fix some data racesBrian Goff2017-02-012-3/+2
| | | | | | | | | After running the test suite with the race detector enabled I found these gems that need to be fixed. This is just round one, sadly lost my test results after I built the binary to test this... (whoops) Signed-off-by: Brian Goff <cpuguy83@gmail.com>
* Merge pull request #29851 from vdemeester/daemon-extract-image-cacheAlexander Morozov2017-01-262-187/+0
|\ | | | | Extract the daemon image cache to its own package
| * Extract the daemon image cache to its own packageVincent Demeester2017-01-032-187/+0
| | | | | | | | | | | | | | ImageCache is now independent of `Daemon` and is located in `image/cache` package. Signed-off-by: Vincent Demeester <vincent@sbr.pm>
* | fix some typos in runconfig\opts\envfile_test.golixiaobing100512672017-01-091-3/+2
|/ | | | Signed-off-by: lixiaobing10051267 <li.xiaobing1@zte.com.cn>
* Clean some stuff from runconfig that are cli only…Vincent Demeester2016-12-2414-2379/+0
| | | | | | | | … or could be in `opts` package. Having `runconfig/opts` and `opts` doesn't really make sense and make it difficult to know where to put some code. Signed-off-by: Vincent Demeester <vincent@sbr.pm>
* return directly without ifs in remaining packagesunclejack2016-12-141-4/+2
| | | | Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
* Merge pull request #28976 from miaoyq/remove-a-redundant-func-and-fix-some-typosBrian Goff2016-12-091-23/+15
|\ | | | | Remove a redundant funtion and fix some typos
| * Remove a redundant funtion and fix some typosYanqiang Miao2016-11-301-23/+15
| | | | | | | | Signed-off-by: Yanqiang Miao <miao.yanqiang@zte.com.cn>
* | Fix a bit typosyuexiao-wang2016-12-091-1/+1
| | | | | | | | Signed-off-by: yuexiao-wang <wang.yuexiao@zte.com.cn>
* | Fix processing of unset build-args during buildDoug Davis2016-12-073-51/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts 26103. 26103 was trying to make it so that if someone did: docker build --build-arg FOO . and FOO wasn't set as an env var then it would pick-up FOO from the Dockerfile's ARG cmd. However, it went too far and removed the ability to specify a build arg w/o any value. Meaning it required the --build-arg param to always be in the form "name=value", and not just "name". This PR does the right fix - it allows just "name" and it'll grab the value from the env vars if set. If "name" isn't set in the env then it still needs to send "name" to the server so that a warning can be printed about an unused --build-arg. And this is why buildArgs in the options is now a *string instead of just a string - 'nil' == mentioned but no value. Closes #29084 Signed-off-by: Doug Davis <dug@us.ibm.com>
* | check testing code for runconfig and volumelixiaobing100512672016-12-011-1/+1
| | | | | | | | Signed-off-by: lixiaobing10051267 <li.xiaobing1@zte.com.cn>
* | cli: remove `--mount` from `docker run`Akihiro Suda2016-11-261-5/+0
|/ | | | | | | This commit reverts 273eeb813c1db0f42c2ad5e053972eeb00907568 (#26825). For the discussion so far, please refer to #28527. Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
* Merge pull request #28667 from Microsoft/jjh/env-case-sensitiveJohn Howard2016-11-232-0/+12
|\ | | | | Windows: Case insensitive env vars
| * Windows: Case insensitive env varsJohn Howard2016-11-232-0/+12
| | | | | | | | Signed-off-by: John Howard <jhoward@microsoft.com>
* | error strings should not be capitalized or end with punctuationyupeng2016-11-221-1/+1
|/ | | | Signed-off-by: yupeng <yu.peng36@zte.com.cn>
* Merge pull request #28440 from cpuguy83/20740_fix_tmpfs_parsing_on_clientJustin Cormack2016-11-161-4/+0
|\ | | | | Don't validate platform-dep tmpfs opts on client