summaryrefslogtreecommitdiff
path: root/cmd
Commit message (Collapse)AuthorAge
* Refactor runtime functions to pass options structureSascha Grunert2020-02-07
| | | | | | | This makes the code easier to read but should not change the overall behavior. Signed-off-by: Sascha Grunert <sgrunert@suse.com>
* Move podman-service to podman-system-serviceMatthew Heon2020-02-06
| | | | | | Fixes #5108 Signed-off-by: Matthew Heon <mheon@redhat.com>
* Merge pull request #5098 from rhatdan/memory-swapOpenShift Merge Robot2020-02-06
|\ | | | | Special case memory-swap=-1
| * Special case memory-swap=-1Daniel J Walsh2020-02-05
| | | | | | | | | | | | | | We document that memory-swap==-1 means unlimited, but currently we won't allow the user to specify the -1 value. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* | Merge pull request #5075 from mheon/filter_forces_allOpenShift Merge Robot2020-02-04
|\ \ | | | | | | Force --all when --filter is passed to podman ps
| * | Force --all when --filter is passed to podman psMatthew Heon2020-02-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When we filter, it should be out of all containers, not just running ones, by default - this is necessary to ensure Docker compatability. Fixes #5050 Signed-off-by: Matthew Heon <mheon@redhat.com>
* | | Fix wrong Containerfile location on buildSascha Grunert2020-02-04
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Podman does select the wrong Containerfile if the current working directory contains a Containerfile but we specify one from a different location. Reproducer: ``` > mkdir 1 > echo FROM scratch > Containerfile > echo FROM golang > 1/Containerfile > podman build -f 1/Containerfile -t test STEP 1: FROM scratch ``` Signed-off-by: Sascha Grunert <sgrunert@suse.com>
* | seperate container create network optionsBrent Baude2020-02-03
|/ | | | | | | | | | | | | | | | | | this pr splits off some of the network container create options into a different flag set. the options in question are: --add-host --dns --dns-opt --dns-search --ip --mac-address --network --no-hosts --publish in the future, these options are going to be added to the pod create flags. this makes that transition easier and provides for less code duplication. Signed-off-by: Brent Baude <bbaude@redhat.com>
* fix longname handling for bindingsBrent Baude2020-01-31
| | | | | | the api needs to account for image input where the image is encoded as a fqd image name. Signed-off-by: Brent Baude <bbaude@redhat.com>
* make image reference for commit optionalBrent Baude2020-01-30
| | | | | | | | to match docker compat, the image tag should be optional. Fixes: #5027 Signed-off-by: Brent Baude <bbaude@redhat.com>
* Throw error on invalid sort valueDaniel J Walsh2020-01-28
| | | | | | | We define the valid sort values, so we should throw an error on invalid sort values. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* Merge pull request #4984 from baude/pullarchoverrideOpenShift Merge Robot2020-01-28
|\ | | | | expose --arch-override option for pull
| * expose --arch-override option for pullBrent Baude2020-01-27
| | | | | | | | | | | | | | | | We no longer wish to hide the --arch-override from the cli on pulls. we now expose it. docs updated. tests already exist. Fixes: #4849 Signed-off-by: Brent Baude <bbaude@redhat.com>
* | Hidden remote flags can be nilBrent Baude2020-01-26
|/ | | | | | | | The pull command has several options that are hidden for the remote client. In that case, when checking to see if the flag has been flipped with .Changed, we get a nil pointer error. Using IsSet is tolerant of this. Fixes: #4706 Signed-off-by: Brent Baude <bbaude@redhat.com>
* Merge pull request #4965 from baude/reviewcorrections3OpenShift Merge Robot2020-01-25
|\ | | | | APIv2 review corrections #3
| * APIv2 review corrections #3Brent Baude2020-01-25
| | | | | | | | | | | | The third pass of corrections for the APIv2. Signed-off-by: Brent Baude <bbaude@redhat.com>
* | fork fatih/camelcaseValentin Rothberg2020-01-25
|/ | | | | | | | | faith/camelcase has been archived and is no longer maintained. The package is sufficiently small and self-contained enough to maintain it in libpod. Fixes: #4783 Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
* seccomp policy: expect profile in config labelValentin Rothberg2020-01-23
| | | | | | | | Move the seccomp profile from a manifest annotation to a config label. This way, we can support it for Docker images as well and provide an easy way to add that data via Dockerfiles. Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
* Merge pull request #4861 from giuseppe/add-cgroups-disabled-conmonOpenShift Merge Robot2020-01-22
|\ | | | | oci_conmon: do not create a cgroup under systemd
| * podman: add new option --cgroups=no-conmonGiuseppe Scrivano2020-01-16
| | | | | | | | | | | | | | | | it allows to disable cgroups creation only for the conmon process. A new cgroup is created for the container payload. Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
* | Add service endpointbaude2020-01-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | add service endpoint for the new API. Also supports the varlink implementation. Signed-off-by: baude <bbaude@redhat.com> Refactor to allow developer more control of API server * Add api.NewServerWithSettings() to create an API server with custom settings * Add api.ListenUnix() to create a UDS net.Listener and setup UDS Signed-off-by: Jhon Honce <jhonce@redhat.com> Signed-off-by: baude <bbaude@redhat.com> More service completion Add podman service command that allows users to run either a RESTful or varlink protocol API service. Addition of docs and RESTful listening. Signed-off-by: baude <bbaude@redhat.com> Signed-off-by: Brent Baude <bbaude@redhat.com>
* | Update `tag` documentation regarding 'alias' usageSascha Grunert2020-01-17
|/ | | | | | | | The word `alias` is not very common when speaking about image names and tags. So we just refer to image name as the overall identifier of an image. Signed-off-by: Sascha Grunert <sgrunert@suse.com>
* Remove c.String(net)Daniel J Walsh2020-01-16
| | | | | | | We have a lot of cludgy code trying to make --net and --network equivalent. This will allow --net to still exists but will eliminate the help and confusion. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* Merge pull request #4868 from jwhonce/wip/sshdOpenShift Merge Robot2020-01-15
|\ | | | | [CI:DOCS] Add APIv2 CLI example POC
| * Add APIv2 CLI example POCJhon Honce2020-01-15
| | | | | | | | | | | | | | * Add ReadMe, CLI and unit files to support socket activation, both for system and rootless Signed-off-by: Jhon Honce <jhonce@redhat.com>
* | Merge pull request #4806 from vrothberg/seccompOpenShift Merge Robot2020-01-15
|\ \ | |/ |/| policy for seccomp-profile selection
| * policy for seccomp-profile selectionValentin Rothberg2020-01-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implement a policy for selecting a seccomp profile. In addition to the default behaviour (default profile unless --security-opt seccomp is set) add a second policy doing a lookup in the image annotation. If the image has the "io.containers.seccomp.profile" set its value will be interpreted as a seccomp profile. The policy can be selected via the new --seccomp-policy CLI flag. Once the containers.conf support is merged into libpod, we can add an option there as well. Note that this feature is marked as experimental and may change in the future. Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
| * shared/create.go: s/data/imageData/Valentin Rothberg2020-01-09
| | | | | | | | | | | | | | Rename `data` to `imageData` to make it more obvious which kind of data the variable refers to. Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
* | make lint: include unit testsValentin Rothberg2020-01-14
| | | | | | | | | | | | | | Include the unit tests (i.e., _test.go files) for linting to make the tests more robust and enforce the linters' coding styles etc. Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
* | Merge pull request #4845 from baude/pruneforceOpenShift Merge Robot2020-01-13
|\ \ | | | | | | clarify cont
| * | clarify container prune --forcebaude2020-01-13
| | | | | | | | | | | | | | | | | | | | | | | | the --force parameter should only be used for the CLI and should only dictate whether to prompt the user for confirmation. Fixes: #4844 Signed-off-by: baude <bbaude@redhat.com>
* | | Merge pull request #4850 from vrothberg/fix-lintingOpenShift Merge Robot2020-01-13
|\ \ \ | | | | | | | | Fix linting
| * | | make lint: enable gocriticValentin Rothberg2020-01-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | `gocritic` is a powerful linter that helps in preventing certain kinds of errors as well as enforcing a coding style. Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
* | | | Merge pull request #4817 from rhatdan/codespellOpenShift Merge Robot2020-01-13
|\ \ \ \ | |/ / / |/| | | Add codespell to validate spelling mistakes in code.
| * | | Add codespell to validate spelling mistakes in code.Daniel J Walsh2020-01-11
| |/ / | | | | | | | | | | | | | | | Fix all errors found by codespell Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* | | Merge pull request #4823 from vrothberg/gen-systemdOpenShift Merge Robot2020-01-12
|\ \ \ | |/ / |/| | podman-generate-systemd --new
| * | podman-generate-systemd --newValentin Rothberg2020-01-09
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a --new flag to podman-generate-systemd to create a new container via podman-run instead of starting an existing container. Creating a new container presents the challenge to find a reverse mapping from a container to the CLI flags it can be created with. We are doing this via `(Container).Config.CreateCommand` field, which includes a copy of the process' command from procFS at creating time. This field may not be useful when the container was not created via the Podman CLI (e.g., via a Python script). Hence, we do not guarantee the correctness of the generated files. Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
* | Initial commit on compatible APIJhon Honce2020-01-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Jhon Honce <jhonce@redhat.com> Create service command Use cd cmd/service && go build . $ systemd-socket-activate -l 8081 cmd/service/service & $ curl http://localhost:8081/v1.24/images/json Signed-off-by: Jhon Honce <jhonce@redhat.com> Correct Makefile Signed-off-by: Jhon Honce <jhonce@redhat.com> Two more stragglers Signed-off-by: Jhon Honce <jhonce@redhat.com> Report errors back as http headers Signed-off-by: Jhon Honce <jhonce@redhat.com> Split out handlers, updated output Output aligned to docker structures Signed-off-by: Jhon Honce <jhonce@redhat.com> Refactored routing, added more endpoints and types * Encapsulated all the routing information in the handler_* files. * Added more serviceapi/types, including podman additions. See Info Signed-off-by: Jhon Honce <jhonce@redhat.com> Cleaned up code, implemented info content * Move Content-Type check into serviceHandler * Custom 404 handler showing the url, mostly for debugging * Refactored images: better method names and explicit http codes * Added content to /info * Added podman fields to Info struct * Added Container struct Signed-off-by: Jhon Honce <jhonce@redhat.com> Add a bunch of endpoints containers: stop, pause, unpause, wait, rm images: tag, rmi, create (pull only) Signed-off-by: baude <bbaude@redhat.com> Add even more handlers * Add serviceapi/Error() to improve error handling * Better support for API return payloads * Renamed unimplemented to unsupported these are generic endpoints we don't intend to ever support. Swarm broken out since it uses different HTTP codes to signal that the node is not in a swarm. * Added more types * API Version broken out so it can be validated in the future Signed-off-by: Jhon Honce <jhonce@redhat.com> Refactor to introduce ServiceWriter Signed-off-by: Jhon Honce <jhonce@redhat.com> populate pods endpoints /libpod/pods/.. exists, kill, pause, prune, restart, remove, start, stop, unpause Signed-off-by: baude <bbaude@redhat.com> Add components to Version, fix Error body Signed-off-by: Jhon Honce <jhonce@redhat.com> Add images pull output, fix swarm routes * docker-py tests/integration/api_client_test.py pass 100% * docker-py tests/integration/api_image_test.py pass 4/16 + Test failures include services podman does not support Signed-off-by: Jhon Honce <jhonce@redhat.com> pods endpoint submission 2 add create and others; only top and stats is left. Signed-off-by: baude <bbaude@redhat.com> Update pull image to work from empty registry Signed-off-by: Jhon Honce <jhonce@redhat.com> pod create and container create first pass at pod and container create. the container create does not quite work yet but it is very close. pod create needs a partial rewrite. also broken off the DELETE (rm/rmi) to specific handler funcs. Signed-off-by: baude <bbaude@redhat.com> Add docker-py demos, GET .../containers/json * Update serviceapi/types to reflect libpod not podman * Refactored removeImage() to provide non-streaming return Signed-off-by: Jhon Honce <jhonce@redhat.com> create container part2 finished minimal config needed for create container. started demo.py for upcoming talk Signed-off-by: baude <bbaude@redhat.com> Stop server after honoring request * Remove casting for method calls * Improve WriteResponse() * Update Container API type to match docker API Signed-off-by: Jhon Honce <jhonce@redhat.com> fix namespace assumptions cleaned up namespace issues with libpod. Signed-off-by: baude <bbaude@redhat.com> wip Signed-off-by: baude <bbaude@redhat.com> Add sliding window when shutting down server * Added a Timeout rather than closing down service on each call * Added gorilla/schema dependency for Decode'ing query parameters * Improved error handling * Container logs returned and multiplexed for stdout and stderr * .../containers/{name}/logs?stdout=True&stderr=True * Container stats * .../containers/{name}/stats Signed-off-by: Jhon Honce <jhonce@redhat.com> Improve error handling * Add check for at least one std stream required for /containers/{id}/logs * Add check for state in /containers/{id}/top * Fill in more fields for /info * Fixed error checking in service start code Signed-off-by: Jhon Honce <jhonce@redhat.com> get rest of image tests for pass Signed-off-by: baude <bbaude@redhat.com> linting our content Signed-off-by: baude <bbaude@redhat.com> more linting Signed-off-by: baude <bbaude@redhat.com> more linting Signed-off-by: baude <bbaude@redhat.com> pruning Signed-off-by: baude <bbaude@redhat.com> [CI:DOCS]apiv2 pods migrate from using args in the url to using a json struct in body for pod create. Signed-off-by: baude <bbaude@redhat.com> fix handler_images prune prune's api changed slightly to deal with filters. Signed-off-by: baude <bbaude@redhat.com> [CI:DOCS]enabled base container create tests enabling the base container create tests which allow us to get more into the stop, kill, etc tests. many new tests now pass. Signed-off-by: baude <bbaude@redhat.com> serviceapi errors: append error message to API message I dearly hope this is not breaking any other tests but debugging "Internal Server Error" is not helpful to any user. In case, it breaks tests, we can rever the commit - that's why it's a small one. Signed-off-by: Valentin Rothberg <rothberg@redhat.com> serviceAPI: add containers/prune endpoint Signed-off-by: Valentin Rothberg <rothberg@redhat.com> add `service` make target Also remove the non-functional sub-Makefile. Signed-off-by: Valentin Rothberg <rothberg@redhat.com> add make targets for testing the service * `sudo make run-service` for running the service. * `DOCKERPY_TEST="tests/integration/api_container_test.py::ListContainersTest" \ make run-docker-py-tests` for running a specific tests. Run all tests by leaving the env variable empty. Signed-off-by: Valentin Rothberg <rothberg@redhat.com> Split handlers and server packages The files were split to help contain bloat. The api/server package will contain all code related to the functioning of the server while api/handlers will have all the code related to implementing the end points. api/server/register_* will contain the methods for registering endpoints. Additionally, they will have the comments for generating the swagger spec file. See api/handlers/version.go for a small example handler, api/handlers/containers.go contains much more complex handlers. Signed-off-by: Jhon Honce <jhonce@redhat.com> [CI:DOCS]enabled more tests Signed-off-by: baude <bbaude@redhat.com> [CI:DOCS]libpod endpoints small refactor for libpod inclusion and began adding endpoints. Signed-off-by: baude <bbaude@redhat.com> Implement /build and /events * Include crypto libraries for future ssh work Signed-off-by: Jhon Honce <jhonce@redhat.com> [CI:DOCS]more image implementations convert from using for to query structs among other changes including new endpoints. Signed-off-by: baude <bbaude@redhat.com> [CI:DOCS]add bindings for golang Signed-off-by: baude <bbaude@redhat.com> [CI:DOCS]add volume endpoints for libpod create, inspect, ls, prune, and rm Signed-off-by: baude <bbaude@redhat.com> [CI:DOCS]apiv2 healthcheck enablement wire up container healthchecks for the api. Signed-off-by: baude <bbaude@redhat.com> [CI:DOCS]Add mount endpoints via the api, allow ability to mount a container and list container mounts. Signed-off-by: baude <bbaude@redhat.com> [CI:DOCS]Add search endpoint add search endpoint with golang bindings Signed-off-by: baude <bbaude@redhat.com> [CI:DOCS]more apiv2 development misc population of methods, etc Signed-off-by: baude <bbaude@redhat.com> rebase cleanup and epoch reset Signed-off-by: baude <bbaude@redhat.com> [CI:DOCS]add more network endpoints also, add some initial error handling and convenience functions for standard endpoints. Signed-off-by: baude <bbaude@redhat.com> [CI:DOCS]use helper funcs for bindings use the methods developed to make writing bindings less duplicative and easier to use. Signed-off-by: baude <bbaude@redhat.com> [CI:DOCS]add return info for prereview begin to add return info and status codes for errors so that we can review the apiv2 Signed-off-by: baude <bbaude@redhat.com> [CI:DOCS]first pass at adding swagger docs for api Signed-off-by: baude <bbaude@redhat.com>
* | Merge pull request #4828 from giuseppe/drop-pause-checkOpenShift Merge Robot2020-01-10
|\ \ | | | | | | cp: drop check for rootless
| * | cp: drop check for rootlessGiuseppe Scrivano2020-01-10
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | rootless containers can use pause on cgroups v2. Whether it is possible or not to use pause depends from multiple conditions, such as: - be on a cgroup v2 unified hierarchy, - using systemd cgroup manager, - the kernel has the freezer controller, The last one may fail for root as well. Instead of trying to catch all the possible conditions in Podman, let the OCI runtime complain if pause cannot be performed. Closes: https://github.com/containers/libpod/issues/4813 Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
* | Merge pull request #4820 from edsantiago/consistent_option_enumerationsOpenShift Merge Robot2020-01-09
|\ \ | |/ |/| Usage messages: show possible option values
| * Usage messages: show possible option valuesEd Santiago2020-01-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ...in a consistent manner: ("a"|"b"|"c") This makes it possible (and easy) for zsh completion to pick those out of the --help messages and offer them as values when user hits TAB. I chose this format because it's an already-existing convention in cmd/podman/common.go. Also: removed two duplicate "default: x" messages (Cobra displays those automatically where a non-null default is specified). Signed-off-by: Ed Santiago <santiago@redhat.com>
* | Merge pull request #4802 from rhatdan/varlinkOpenShift Merge Robot2020-01-09
|\ \ | |/ |/| Fix podman-remote info to show registry data
| * Fix podman-remote info to show registry dataDaniel J Walsh2020-01-07
| | | | | | | | Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* | Add `untag` sub-commandSascha Grunert2020-01-08
|/ | | | | | | | Podman now supports untagging images via the `untag` sub-command for the root and `image` commands. Testing and documentation has been added as well. Signed-off-by: Sascha Grunert <sgrunert@suse.com>
* Merge pull request #4781 from haircommander/seccomp-profile-rootOpenShift Merge Robot2020-01-07
|\ | | | | play kube: make seccomp handling better conform to k8s
| * play kube: make seccomp handling better conform to k8sPeter Hunt2020-01-03
| | | | | | | | | | | | | | Add flag --seccomp-profile-root in play kube to allow users to specify where to look for seccomp profiles update tests Signed-off-by: Peter Hunt <pehunt@redhat.com>
* | fix bug copy from container directoryQi Wang2020-01-02
|/ | | | | | Keep the original input source path with "/." so podman can copy the content of the directory when copying from container to host. Signed-off-by: Qi Wang <qiwan@redhat.com>
* Merge pull request #4748 from NevilleC/nc-podnameOpenShift Merge Robot2019-12-29
|\ | | | | [Issue #4703] Add the pod name when we use `podman ps -p`
| * Add the pod name when we use `podman ps -p`Neville Cain2019-12-28
| | | | | | | | | | | | | | | | | | | | | | | | The pod name does not appear when doing `podman ps -p`. It is missing as the documentation says: -p, --pod Print the ID and name of the pod the containers are associated with The pod name is added in the ps output and checked in unit tests. Closes #4703 Signed-off-by: NevilleC <neville.cain@qonto.eu>