-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Podman V2 birth #5852
Merged
+1,054
−24,478
Merged
Podman V2 birth #5852
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,4 +30,3 @@ podman*.tar.gz | |
contrib/spec/podman.spec | ||
*.rpm | ||
*.coverprofile | ||
/cmd/podmanV2/podmanV2* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,113 @@ | ||
# Podman - Simple debugging tool for pods and images | ||
Podman is a daemonless container runtime for managing containers, pods, and container images. | ||
It is intended as a counterpart to CRI-O, to provide low-level debugging not available through the CRI interface used by Kubernetes. | ||
It can also act as a container runtime independent of CRI-O, creating and managing its own set of containers. | ||
|
||
## Use cases | ||
1. Create containers | ||
2. Start, stop, signal, attach to, and inspect existing containers | ||
3. Run new commands in existing containers | ||
4. Push and pull images | ||
5. List and inspect existing images | ||
6. Create new images by committing changes within a container | ||
7. Create pods | ||
8. Start, stop, signal, and inspect existing pods | ||
9. Populate pods with containers | ||
# Adding a podman V2 commands | ||
|
||
## Build podman V2 | ||
|
||
```shell script | ||
$ cd $GOPATH/src/github.com/containers/libpod/cmd/podmanV2 | ||
``` | ||
If you wish to include the libpod library in your program, | ||
```shell script | ||
$ go build -tags 'ABISupport' . | ||
``` | ||
The `--remote` flag may be used to connect to the Podman service using the API. | ||
Otherwise, direct calls will be made to the Libpod library. | ||
```shell script | ||
$ go build -tags '!ABISupport' . | ||
``` | ||
The Libpod library is not linked into the executable. | ||
All calls are made via the API and `--remote=False` is an error condition. | ||
|
||
## Adding a new command `podman manifests` | ||
```shell script | ||
$ mkdir -p $GOPATH/src/github.com/containers/libpod/cmd/podmanV2/manifests | ||
``` | ||
Create the file ```$GOPATH/src/github.com/containers/libpod/cmd/podmanV2/manifests/manifest.go``` | ||
```go | ||
package manifests | ||
|
||
import ( | ||
"github.com/containers/libpod/cmd/podman/registry" | ||
"github.com/containers/libpod/pkg/domain/entities" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var ( | ||
// podman _manifests_ | ||
manifestCmd = &cobra.Command{ | ||
Use: "manifest", | ||
Short: "Manage manifests", | ||
Long: "Manage manifests", | ||
Example: "podman manifests IMAGE", | ||
TraverseChildren: true, | ||
PersistentPreRunE: preRunE, | ||
RunE: registry.SubCommandExists, // Report error if there is no sub command given | ||
} | ||
) | ||
func init() { | ||
// Subscribe command to podman | ||
registry.Commands = append(registry.Commands, registry.CliCommand{ | ||
// _podman manifest_ will support both ABIMode and TunnelMode | ||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode}, | ||
// The definition for this command | ||
Command: manifestCmd, | ||
}) | ||
// Setup cobra templates, sub commands will inherit | ||
manifestCmd.SetHelpTemplate(registry.HelpTemplate()) | ||
manifestCmd.SetUsageTemplate(registry.UsageTemplate()) | ||
} | ||
|
||
// preRunE populates the image engine for sub commands | ||
func preRunE(cmd *cobra.Command, args []string) error { | ||
_, err := registry.NewImageEngine(cmd, args) | ||
return err | ||
} | ||
``` | ||
To "wire" in the `manifest` command, edit the file ```$GOPATH/src/github.com/containers/libpod/cmd/podmanV2/main.go``` to add: | ||
```go | ||
package main | ||
|
||
import _ "github.com/containers/libpod/cmd/podman/manifests" | ||
``` | ||
|
||
## Adding a new sub command `podman manifests list` | ||
Create the file ```$GOPATH/src/github.com/containers/libpod/cmd/podmanV2/manifests/inspect.go``` | ||
```go | ||
package manifests | ||
|
||
import ( | ||
"github.com/containers/libpod/cmd/podman/registry" | ||
"github.com/containers/libpod/pkg/domain/entities" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var ( | ||
// podman manifests _inspect_ | ||
inspectCmd = &cobra.Command{ | ||
Use: "inspect IMAGE", | ||
Short: "Display manifest from image", | ||
Long: "Displays the low-level information on a manifest identified by image name or ID", | ||
RunE: inspect, | ||
Example: "podman manifest DEADBEEF", | ||
} | ||
) | ||
|
||
func init() { | ||
// Subscribe inspect sub command to manifest command | ||
registry.Commands = append(registry.Commands, registry.CliCommand{ | ||
// _podman manifest inspect_ will support both ABIMode and TunnelMode | ||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode}, | ||
// The definition for this command | ||
Command: inspectCmd, | ||
Parent: manifestCmd, | ||
}) | ||
|
||
// This is where you would configure the cobra flags using inspectCmd.Flags() | ||
} | ||
|
||
// Business logic: cmd is inspectCmd, args is the positional arguments from os.Args | ||
func inspect(cmd *cobra.Command, args []string) error { | ||
// Business logic using registry.ImageEngine | ||
// Do not pull from libpod directly use the domain objects and types | ||
return nil | ||
} | ||
``` |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit, wouldn't this be
Create the file ```$GOPATH/src/github.com/containers/libpod/cmd/podman/manifests/inspect.go
now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we take prs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but you're so good at them 😃