Skip to content
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

Enable parsing the OCI linux configuration on non-linux platforms #135

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions config.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package specs

import (
"encoding/json"
)

// Spec is the base configuration for the container. It specifies platform
// independent configuration.
type Spec struct {
Expand All @@ -21,8 +25,8 @@ type Spec struct {
type Process struct {
// Terminal creates an interactive terminal for the container.
Terminal bool `json:"terminal"`
// User specifies user information for the process.
User User `json:"user"`
// User specifies user information for the process. It is a platform-specific structure.
User json.RawMessage `json:"user"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can User be a string?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On Wed, Dec 16, 2015 at 10:25:08AM -0800, Vish Kannan wrote:

@@ -21,8 +25,8 @@ type Spec struct {
type Process struct {
// Terminal creates an interactive terminal for the container.
Terminal bool json:"terminal"

  • // User specifies user information for the process.
  • User User json:"user"
  • // User specifies user information for the process. It is a platform-specific structure.
  • User json.RawMessage json:"user"

Can User be a string?

User as a string requires /etc/passwd lookups or some such on Linux,
and I don't think we want to require that (although I'm fine with it
as an option). See my suggestions in #191 for an alternative that
allows both name-based and number-based identification 1, but that's
going to be platform-specific.

// Args specifies the binary and arguments for the application to execute.
Args []string `json:"args"`
// Env populates the process environment for the process.
Expand Down
8 changes: 5 additions & 3 deletions config_linux.go → linux/config.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
// +build linux
package linux

package specs
import (
"github.com/opencontainers/specs"
)

// LinuxSpec is the full specification for linux containers.
type LinuxSpec struct {
Spec
specs.Spec
// Linux is platform specific configuration for linux based containers.
Linux Linux `json:"linux"`
}
Expand Down
File renamed without changes.
10 changes: 7 additions & 3 deletions runtime_config_linux.go → linux/runtime-config.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
package specs
package linux

import "os"
import (
"os"

"github.com/opencontainers/specs"
)

// LinuxStateDirectory holds the container's state information
const LinuxStateDirectory = "/run/opencontainer/containers"

// LinuxRuntimeSpec is the full specification for linux containers.
type LinuxRuntimeSpec struct {
RuntimeSpec
specs.RuntimeSpec
// LinuxRuntime is platform specific configuration for linux based containers.
Linux LinuxRuntime `json:"linux"`
}
Expand Down
File renamed without changes.
File renamed without changes.