summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd/podman/common/create.go10
-rw-r--r--cmd/podman/common/create_opts.go2
-rw-r--r--cmd/podman/containers/run.go6
-rw-r--r--docs/source/markdown/podman-create.1.md17
-rw-r--r--docs/source/markdown/podman-run.1.md12
-rw-r--r--libpod/container_internal_linux.go13
-rw-r--r--libpod/events/filters.go4
-rw-r--r--pkg/api/handlers/compat/containers.go23
-rw-r--r--pkg/api/handlers/compat/networks.go79
-rw-r--r--pkg/api/handlers/compat/swagger.go14
-rw-r--r--pkg/api/server/register_networks.go57
-rw-r--r--test/e2e/attach_test.go4
-rw-r--r--test/e2e/create_test.go18
-rw-r--r--test/e2e/generate_systemd_test.go4
-rw-r--r--test/e2e/init_test.go10
-rw-r--r--test/e2e/logs_test.go2
-rw-r--r--test/e2e/pod_rm_test.go2
-rw-r--r--test/e2e/ps_test.go2
-rw-r--r--test/e2e/restart_test.go2
-rw-r--r--test/e2e/run_networking_test.go12
-rw-r--r--test/e2e/run_security_labels.go4
-rw-r--r--test/e2e/run_volume_test.go2
-rw-r--r--test/e2e/start_test.go14
-rw-r--r--test/e2e/stop_test.go2
-rw-r--r--test/e2e/systemd_test.go2
-rw-r--r--test/system/250-systemd.bats2
26 files changed, 232 insertions, 87 deletions
diff --git a/cmd/podman/common/create.go b/cmd/podman/common/create.go
index 0ec422313..60f4e526c 100644
--- a/cmd/podman/common/create.go
+++ b/cmd/podman/common/create.go
@@ -115,16 +115,6 @@ func GetCreateFlags(cf *ContainerCLIOpts) *pflag.FlagSet {
"cpuset-mems", "",
"Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effective on NUMA systems.",
)
- createFlags.BoolVarP(
- &cf.Detach,
- "detach", "d", false,
- "Run container in background and print container ID",
- )
- createFlags.StringVar(
- &cf.DetachKeys,
- "detach-keys", containerConfig.DetachKeys(),
- "Override the key sequence for detaching a container. Format is a single character `[a-Z]` or a comma separated sequence of `ctrl-<value>`, where `<value>` is one of: `a-cf`, `@`, `^`, `[`, `\\`, `]`, `^` or `_`",
- )
createFlags.StringSliceVar(
&cf.Devices,
"device", containerConfig.Devices(),
diff --git a/cmd/podman/common/create_opts.go b/cmd/podman/common/create_opts.go
index f4fecf4b7..5dea49c8b 100644
--- a/cmd/podman/common/create_opts.go
+++ b/cmd/podman/common/create_opts.go
@@ -32,8 +32,6 @@ type ContainerCLIOpts struct {
CPUS float64
CPUSetCPUs string
CPUSetMems string
- Detach bool
- DetachKeys string
Devices []string
DeviceCGroupRule []string
DeviceReadBPs []string
diff --git a/cmd/podman/containers/run.go b/cmd/podman/containers/run.go
index f8c248b04..6b294d69a 100644
--- a/cmd/podman/containers/run.go
+++ b/cmd/podman/containers/run.go
@@ -63,6 +63,8 @@ func runFlags(flags *pflag.FlagSet) {
flags.BoolVar(&runOpts.SigProxy, "sig-proxy", true, "Proxy received signals to the process")
flags.BoolVar(&runRmi, "rmi", false, "Remove container image unless used by other containers")
flags.UintVar(&runOpts.PreserveFDs, "preserve-fds", 0, "Pass a number of additional file descriptors into the container")
+ flags.BoolVarP(&runOpts.Detach, "detach", "d", false, "Run container in background and print container ID")
+ flags.StringVar(&runOpts.DetachKeys, "detach-keys", containerConfig.DetachKeys(), "Override the key sequence for detaching a container. Format is a single character `[a-Z]` or a comma separated sequence of `ctrl-<value>`, where `<value>` is one of: `a-cf`, `@`, `^`, `[`, `\\`, `]`, `^` or `_`")
_ = flags.MarkHidden("signature-policy")
if registry.IsRemote() {
@@ -171,8 +173,6 @@ func run(cmd *cobra.Command, args []string) error {
}
}
}
- runOpts.Detach = cliVals.Detach
- runOpts.DetachKeys = cliVals.DetachKeys
cliVals.PreserveFDs = runOpts.PreserveFDs
s := specgen.NewSpecGenerator(imageName, cliVals.RootFS)
if err := common.FillOutSpecGen(s, &cliVals, args); err != nil {
@@ -200,7 +200,7 @@ func run(cmd *cobra.Command, args []string) error {
}
}
- if cliVals.Detach {
+ if runOpts.Detach {
fmt.Println(report.Id)
return nil
}
diff --git a/docs/source/markdown/podman-create.1.md b/docs/source/markdown/podman-create.1.md
index f9a23d314..1f229a3a0 100644
--- a/docs/source/markdown/podman-create.1.md
+++ b/docs/source/markdown/podman-create.1.md
@@ -183,23 +183,6 @@ If you have four memory nodes on your system (0-3), use `--cpuset-mems=0,1`
then processes in your container will only use memory from the first
two memory nodes.
-**--detach**, **-d**=*true|false*
-
-Detached mode: run the container in the background and print the new container ID. The default is *false*.
-
-At any time you can run **podman ps** in
-the other shell to view a list of the running containers. You can reattach to a
-detached container with **podman attach**.
-
-When attached in the tty mode, you can detach from the container (and leave it
-running) using a configurable key sequence. The default sequence is `ctrl-p,ctrl-q`.
-Configure the keys sequence using the **--detach-keys** option, or specifying
-it in the **containers.conf** file: see **containers.conf(5)** for more information.
-
-**--detach-keys**=*sequence*
-
-Specify the key sequence for detaching a container. Format is a single character `[a-Z]` or one or more `ctrl-<value>` characters where `<value>` is one of: `a-z`, `@`, `^`, `[`, `,` or `_`. Specifying "" will disable this feature. The default is *ctrl-p,ctrl-q*.
-
**--device**=_host-device_[**:**_container-device_][**:**_permissions_]
Add a host device to the container. Optional *permissions* parameter
diff --git a/docs/source/markdown/podman-run.1.md b/docs/source/markdown/podman-run.1.md
index 2c8aa3a26..b86c9b363 100644
--- a/docs/source/markdown/podman-run.1.md
+++ b/docs/source/markdown/podman-run.1.md
@@ -197,20 +197,20 @@ to only use memory from the first two memory nodes.
**--detach**, **-d**=**true**|**false**
-Detached mode: run the container in the background and print the new container ID. The default is **false**.
+Detached mode: run the container in the background and print the new container ID. The default is *false*.
At any time you can run **podman ps** in
the other shell to view a list of the running containers. You can reattach to a
detached container with **podman attach**.
When attached in the tty mode, you can detach from the container (and leave it
-running) using a configurable key sequence.
+running) using a configurable key sequence. The default sequence is `ctrl-p,ctrl-q`.
+Configure the keys sequence using the **--detach-keys** option, or specifying
+it in the **containers.conf** file: see **containers.conf(5)** for more information.
-**--detach-keys**=_sequence_
+**--detach-keys**=*sequence*
-Specify the key sequence for detaching a container; _sequence_ is a comma-delimited set
-in which each item can be a single character from the [a-Z] range,
-or **ctrl**-_value_, where _value_ is one of: **a-z** or **@^[,_**.
+Specify the key sequence for detaching a container. Format is a single character `[a-Z]` or one or more `ctrl-<value>` characters where `<value>` is one of: `a-z`, `@`, `^`, `[`, `,` or `_`. Specifying "" will disable this feature. The default is *ctrl-p,ctrl-q*.
This option can also be set in **containers.conf**(5) file.
diff --git a/libpod/container_internal_linux.go b/libpod/container_internal_linux.go
index ffb2f5b73..a1b4334fb 100644
--- a/libpod/container_internal_linux.go
+++ b/libpod/container_internal_linux.go
@@ -1412,7 +1412,8 @@ func (c *Container) generateResolvConf() (string, error) {
// Determine the endpoint for resolv.conf in case it is a symlink
resolvPath, err := filepath.EvalSymlinks(resolvConf)
- if err != nil {
+ // resolv.conf doesn't have to exists
+ if err != nil && !os.IsNotExist(err) {
return "", err
}
@@ -1422,7 +1423,8 @@ func (c *Container) generateResolvConf() (string, error) {
}
contents, err := ioutil.ReadFile(resolvPath)
- if err != nil {
+ // resolv.conf doesn't have to exists
+ if err != nil && !os.IsNotExist(err) {
return "", errors.Wrapf(err, "unable to read %s", resolvPath)
}
@@ -1550,9 +1552,13 @@ func (c *Container) getHosts() string {
hosts += fmt.Sprintf("# used by slirp4netns\n%s\t%s %s\n", "10.0.2.100", c.Hostname(), c.config.Name)
} else {
hasNetNS := false
+ netNone := false
for _, ns := range c.config.Spec.Linux.Namespaces {
if ns.Type == spec.NetworkNamespace {
hasNetNS = true
+ if ns.Path == "" && !c.config.CreateNetNS {
+ netNone = true
+ }
break
}
}
@@ -1564,6 +1570,9 @@ func (c *Container) getHosts() string {
}
hosts += fmt.Sprintf("127.0.1.1 %s\n", osHostname)
}
+ if netNone {
+ hosts += fmt.Sprintf("127.0.1.1 %s\n", c.Hostname())
+ }
}
}
return hosts
diff --git a/libpod/events/filters.go b/libpod/events/filters.go
index c50474007..171e2237f 100644
--- a/libpod/events/filters.go
+++ b/libpod/events/filters.go
@@ -73,8 +73,8 @@ func generateEventUntilOption(timeUntil time.Time) func(e *Event) bool {
}
func parseFilter(filter string) (string, string, error) {
- filterSplit := strings.Split(filter, "=")
- if len(filterSplit) != 2 {
+ filterSplit := strings.SplitN(filter, "=", 2)
+ if len(filterSplit) == 1 {
return "", "", errors.Errorf("%s is an invalid filter", filter)
}
return filterSplit[0], filterSplit[1], nil
diff --git a/pkg/api/handlers/compat/containers.go b/pkg/api/handlers/compat/containers.go
index cae8f88fd..00be8e845 100644
--- a/pkg/api/handlers/compat/containers.go
+++ b/pkg/api/handlers/compat/containers.go
@@ -410,25 +410,14 @@ func LibpodToContainerJSON(l *libpod.Container, sz bool) (*types.ContainerJSON,
return nil, err
}
- networkSettingsDefault := types.DefaultNetworkSettings{
- EndpointID: "",
- Gateway: "",
- GlobalIPv6Address: "",
- GlobalIPv6PrefixLen: 0,
- IPAddress: "",
- IPPrefixLen: 0,
- IPv6Gateway: "",
- MacAddress: l.Config().StaticMAC.String(),
- }
-
- networkSettingsBase := types.NetworkSettingsBase{
- Ports: ports,
+ n, err := json.Marshal(inspect.NetworkSettings)
+ if err != nil {
+ return nil, err
}
- networkSettings := types.NetworkSettings{
- NetworkSettingsBase: networkSettingsBase,
- DefaultNetworkSettings: networkSettingsDefault,
- Networks: nil,
+ networkSettings := types.NetworkSettings{}
+ if err := json.Unmarshal(n, &networkSettings); err != nil {
+ return nil, err
}
c := types.ContainerJSON{
diff --git a/pkg/api/handlers/compat/networks.go b/pkg/api/handlers/compat/networks.go
index 629ca565e..8011c0a04 100644
--- a/pkg/api/handlers/compat/networks.go
+++ b/pkg/api/handlers/compat/networks.go
@@ -20,6 +20,7 @@ import (
dockerNetwork "github.com/docker/docker/api/types/network"
"github.com/gorilla/schema"
"github.com/pkg/errors"
+ "github.com/sirupsen/logrus"
)
func InspectNetwork(w http.ResponseWriter, r *http.Request) {
@@ -315,3 +316,81 @@ func RemoveNetwork(w http.ResponseWriter, r *http.Request) {
}
utils.WriteResponse(w, http.StatusNoContent, "")
}
+
+// Connect adds a container to a network
+// TODO: For now this func is a no-op that checks the container name, network name, and
+// responds with a 200. This allows the call to remain intact. We need to decide how
+// we make this work with CNI networking and setup/teardown.
+func Connect(w http.ResponseWriter, r *http.Request) {
+ runtime := r.Context().Value("runtime").(*libpod.Runtime)
+
+ var netConnect types.NetworkConnect
+ if err := json.NewDecoder(r.Body).Decode(&netConnect); err != nil {
+ utils.Error(w, "Something went wrong.", http.StatusInternalServerError, errors.Wrap(err, "Decode()"))
+ return
+ }
+ config, err := runtime.GetConfig()
+ if err != nil {
+ utils.InternalServerError(w, err)
+ return
+ }
+ name := utils.GetName(r)
+ exists, err := network.Exists(config, name)
+ if err != nil {
+ utils.InternalServerError(w, err)
+ return
+ }
+ if !exists {
+ utils.Error(w, "network not found", http.StatusNotFound, define.ErrNoSuchNetwork)
+ return
+ }
+ if _, err = runtime.LookupContainer(netConnect.Container); err != nil {
+ if errors.Cause(err) == define.ErrNoSuchCtr {
+ utils.ContainerNotFound(w, netConnect.Container, err)
+ return
+ }
+ utils.Error(w, "unable to lookup container", http.StatusInternalServerError, err)
+ return
+ }
+ logrus.Warnf("network connect endpoint is not fully implemented - tried to connect container %s to network %s", netConnect.Container, name)
+ utils.WriteResponse(w, http.StatusOK, "OK")
+}
+
+// Disconnect removes a container from a network
+// TODO: For now this func is a no-op that checks the container name, network name, and
+// responds with a 200. This allows the call to remain intact. We need to decide how
+// we make this work with CNI networking and setup/teardown.
+func Disconnect(w http.ResponseWriter, r *http.Request) {
+ runtime := r.Context().Value("runtime").(*libpod.Runtime)
+
+ var netDisconnect types.NetworkDisconnect
+ if err := json.NewDecoder(r.Body).Decode(&netDisconnect); err != nil {
+ utils.Error(w, "Something went wrong.", http.StatusInternalServerError, errors.Wrap(err, "Decode()"))
+ return
+ }
+ config, err := runtime.GetConfig()
+ if err != nil {
+ utils.InternalServerError(w, err)
+ return
+ }
+ name := utils.GetName(r)
+ exists, err := network.Exists(config, name)
+ if err != nil {
+ utils.InternalServerError(w, err)
+ return
+ }
+ if !exists {
+ utils.Error(w, "network not found", http.StatusNotFound, define.ErrNoSuchNetwork)
+ return
+ }
+ if _, err = runtime.LookupContainer(netDisconnect.Container); err != nil {
+ if errors.Cause(err) == define.ErrNoSuchCtr {
+ utils.ContainerNotFound(w, netDisconnect.Container, err)
+ return
+ }
+ utils.Error(w, "unable to lookup container", http.StatusInternalServerError, err)
+ return
+ }
+ logrus.Warnf("network disconnect endpoint is not fully implemented - tried to connect container %s to network %s", netDisconnect.Container, name)
+ utils.WriteResponse(w, http.StatusOK, "OK")
+}
diff --git a/pkg/api/handlers/compat/swagger.go b/pkg/api/handlers/compat/swagger.go
index 371d02388..0a514822b 100644
--- a/pkg/api/handlers/compat/swagger.go
+++ b/pkg/api/handlers/compat/swagger.go
@@ -63,3 +63,17 @@ type swagCompatNetworkCreateResponse struct {
// in:body
Body struct{ types.NetworkCreate }
}
+
+// Network disconnect
+// swagger:model NetworkConnectRequest
+type swagCompatNetworkConnectRequest struct {
+ // in:body
+ Body struct{ types.NetworkConnect }
+}
+
+// Network disconnect
+// swagger:model NetworkDisconnectRequest
+type swagCompatNetworkDisconnectRequest struct {
+ // in:body
+ Body struct{ types.NetworkDisconnect }
+}
diff --git a/pkg/api/server/register_networks.go b/pkg/api/server/register_networks.go
index 61916eedf..6222006e5 100644
--- a/pkg/api/server/register_networks.go
+++ b/pkg/api/server/register_networks.go
@@ -98,6 +98,63 @@ func (s *APIServer) registerNetworkHandlers(r *mux.Router) error {
// $ref: "#/responses/InternalError"
r.HandleFunc(VersionedPath("/networks/create"), s.APIHandler(compat.CreateNetwork)).Methods(http.MethodPost)
r.HandleFunc("/networks/create", s.APIHandler(compat.CreateNetwork)).Methods(http.MethodPost)
+ // swagger:operation POST /networks/{name}/connect compat compatConnectNetwork
+ // ---
+ // tags:
+ // - networks (compat)
+ // summary: Connect container to network
+ // description: Connect a container to a network. This endpoint is current a no-op
+ // produces:
+ // - application/json
+ // parameters:
+ // - in: path
+ // name: name
+ // type: string
+ // required: true
+ // description: the name of the network
+ // - in: body
+ // name: create
+ // description: attributes for connecting a container to a network
+ // schema:
+ // $ref: "#/definitions/NetworkConnectRequest"
+ // responses:
+ // 200:
+ // description: OK
+ // 400:
+ // $ref: "#/responses/BadParamError"
+ // 500:
+ // $ref: "#/responses/InternalError"
+ r.HandleFunc(VersionedPath("/networks/{name}/connect"), s.APIHandler(compat.Connect)).Methods(http.MethodPost)
+ r.HandleFunc("/networks/{name}/connect", s.APIHandler(compat.Connect)).Methods(http.MethodPost)
+ // swagger:operation POST /networks/{name}/disconnect compat compatDisconnectNetwork
+ // ---
+ // tags:
+ // - networks (compat)
+ // summary: Disconnect container from network
+ // description: Disconnect a container from a network. This endpoint is current a no-op
+ // produces:
+ // - application/json
+ // parameters:
+ // - in: path
+ // name: name
+ // type: string
+ // required: true
+ // description: the name of the network
+ // - in: body
+ // name: create
+ // description: attributes for disconnecting a container from a network
+ // schema:
+ // $ref: "#/definitions/NetworkDisconnectRequest"
+ // responses:
+ // 200:
+ // description: OK
+ // 400:
+ // $ref: "#/responses/BadParamError"
+ // 500:
+ // $ref: "#/responses/InternalError"
+ r.HandleFunc(VersionedPath("/networks/{name}/disconnect"), s.APIHandler(compat.Disconnect)).Methods(http.MethodPost)
+ r.HandleFunc("/networks/{name}/disconnect", s.APIHandler(compat.Disconnect)).Methods(http.MethodPost)
+
// swagger:operation DELETE /libpod/networks/{name} libpod libpodRemoveNetwork
// ---
// tags:
diff --git a/test/e2e/attach_test.go b/test/e2e/attach_test.go
index 8065f6298..0c27e05c7 100644
--- a/test/e2e/attach_test.go
+++ b/test/e2e/attach_test.go
@@ -40,7 +40,7 @@ var _ = Describe("Podman attach", func() {
})
It("podman attach to non-running container", func() {
- session := podmanTest.Podman([]string{"create", "--name", "test1", "-d", "-i", ALPINE, "ls"})
+ session := podmanTest.Podman([]string{"create", "--name", "test1", "-i", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@@ -50,7 +50,7 @@ var _ = Describe("Podman attach", func() {
})
It("podman container attach to non-running container", func() {
- session := podmanTest.Podman([]string{"container", "create", "--name", "test1", "-d", "-i", ALPINE, "ls"})
+ session := podmanTest.Podman([]string{"container", "create", "--name", "test1", "-i", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
diff --git a/test/e2e/create_test.go b/test/e2e/create_test.go
index 96a234446..6b0f7a7af 100644
--- a/test/e2e/create_test.go
+++ b/test/e2e/create_test.go
@@ -626,4 +626,22 @@ var _ = Describe("Podman create", func() {
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(BeZero())
})
+
+ It("podman create -d should fail, can not detach create containers", func() {
+ session := podmanTest.Podman([]string{"create", "-d", ALPINE})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(125))
+ Expect(session.ErrorToString()).To(ContainSubstring("unknown shorthand flag"))
+
+ session = podmanTest.Podman([]string{"create", "--detach", ALPINE})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(125))
+ Expect(session.ErrorToString()).To(ContainSubstring("unknown flag"))
+
+ session = podmanTest.Podman([]string{"create", "--detach-keys", "ctrl-x", ALPINE})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(125))
+ Expect(session.ErrorToString()).To(ContainSubstring("unknown flag"))
+ })
+
})
diff --git a/test/e2e/generate_systemd_test.go b/test/e2e/generate_systemd_test.go
index da2f67754..765844265 100644
--- a/test/e2e/generate_systemd_test.go
+++ b/test/e2e/generate_systemd_test.go
@@ -244,7 +244,7 @@ var _ = Describe("Podman generate systemd", func() {
})
It("podman generate systemd --new with explicit detaching param in middle", func() {
- n := podmanTest.Podman([]string{"create", "--name", "foo", "-d", "alpine", "top"})
+ n := podmanTest.Podman([]string{"create", "--name", "foo", "alpine", "top"})
n.WaitWithDefaultTimeout()
Expect(n.ExitCode()).To(Equal(0))
@@ -253,7 +253,7 @@ var _ = Describe("Podman generate systemd", func() {
Expect(session.ExitCode()).To(Equal(0))
// Grepping the output (in addition to unit tests)
- found, _ := session.GrepString("--name foo -d alpine top")
+ found, _ := session.GrepString("--name foo alpine top")
Expect(found).To(BeTrue())
})
diff --git a/test/e2e/init_test.go b/test/e2e/init_test.go
index baa5c5717..3e64cfda2 100644
--- a/test/e2e/init_test.go
+++ b/test/e2e/init_test.go
@@ -45,7 +45,7 @@ var _ = Describe("Podman init", func() {
})
It("podman init single container by ID", func() {
- session := podmanTest.Podman([]string{"create", "-d", ALPINE, "ls"})
+ session := podmanTest.Podman([]string{"create", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
cid := session.OutputToString()
@@ -61,7 +61,7 @@ var _ = Describe("Podman init", func() {
It("podman init single container by name", func() {
name := "test1"
- session := podmanTest.Podman([]string{"create", "--name", name, "-d", ALPINE, "ls"})
+ session := podmanTest.Podman([]string{"create", "--name", name, ALPINE, "ls"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
init := podmanTest.Podman([]string{"init", name})
@@ -76,7 +76,7 @@ var _ = Describe("Podman init", func() {
It("podman init latest container", func() {
SkipIfRemote("--latest flag n/a")
- session := podmanTest.Podman([]string{"create", "-d", ALPINE, "ls"})
+ session := podmanTest.Podman([]string{"create", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
init := podmanTest.Podman([]string{"init", "--latest"})
@@ -90,10 +90,10 @@ var _ = Describe("Podman init", func() {
})
It("podman init all three containers, one running", func() {
- session := podmanTest.Podman([]string{"create", "--name", "test1", "-d", ALPINE, "ls"})
+ session := podmanTest.Podman([]string{"create", "--name", "test1", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- session2 := podmanTest.Podman([]string{"create", "--name", "test2", "-d", ALPINE, "ls"})
+ session2 := podmanTest.Podman([]string{"create", "--name", "test2", ALPINE, "ls"})
session2.WaitWithDefaultTimeout()
Expect(session2.ExitCode()).To(Equal(0))
session3 := podmanTest.Podman([]string{"run", "--name", "test3", "-d", ALPINE, "top"})
diff --git a/test/e2e/logs_test.go b/test/e2e/logs_test.go
index 664d4831e..4214bd50e 100644
--- a/test/e2e/logs_test.go
+++ b/test/e2e/logs_test.go
@@ -148,7 +148,7 @@ var _ = Describe("Podman logs", func() {
})
It("podman logs on a created container should result in 0 exit code", func() {
- session := podmanTest.Podman([]string{"create", "-dt", "--name", "log", ALPINE})
+ session := podmanTest.Podman([]string{"create", "-t", "--name", "log", ALPINE})
session.WaitWithDefaultTimeout()
Expect(session).To(Exit(0))
diff --git a/test/e2e/pod_rm_test.go b/test/e2e/pod_rm_test.go
index 24643e6b2..24e945d5a 100644
--- a/test/e2e/pod_rm_test.go
+++ b/test/e2e/pod_rm_test.go
@@ -167,7 +167,7 @@ var _ = Describe("Podman pod rm", func() {
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- session = podmanTest.Podman([]string{"create", "-d", "--pod", podid1, ALPINE, "ls"})
+ session = podmanTest.Podman([]string{"create", "--pod", podid1, ALPINE, "ls"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
diff --git a/test/e2e/ps_test.go b/test/e2e/ps_test.go
index c65738993..11d0b8c9b 100644
--- a/test/e2e/ps_test.go
+++ b/test/e2e/ps_test.go
@@ -324,7 +324,7 @@ var _ = Describe("Podman ps", func() {
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- session = podmanTest.Podman([]string{"create", "-dt", ALPINE, "top"})
+ session = podmanTest.Podman([]string{"create", "-t", ALPINE, "top"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
diff --git a/test/e2e/restart_test.go b/test/e2e/restart_test.go
index 789b4dee5..114bd481a 100644
--- a/test/e2e/restart_test.go
+++ b/test/e2e/restart_test.go
@@ -54,7 +54,7 @@ var _ = Describe("Podman restart", func() {
})
It("Podman restart stopped container by ID", func() {
- session := podmanTest.Podman([]string{"create", "-d", ALPINE, "ls"})
+ session := podmanTest.Podman([]string{"create", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
cid := session.OutputToString()
diff --git a/test/e2e/run_networking_test.go b/test/e2e/run_networking_test.go
index 540ac5409..9f6fd8602 100644
--- a/test/e2e/run_networking_test.go
+++ b/test/e2e/run_networking_test.go
@@ -357,7 +357,7 @@ var _ = Describe("Podman run networking", func() {
})
It("podman run network expose ports in image metadata", func() {
- session := podmanTest.Podman([]string{"create", "--name", "test", "-dt", "-P", nginx})
+ session := podmanTest.Podman([]string{"create", "--name", "test", "-t", "-P", nginx})
session.Wait(90)
Expect(session.ExitCode()).To(Equal(0))
results := podmanTest.Podman([]string{"inspect", "test"})
@@ -584,6 +584,14 @@ var _ = Describe("Podman run networking", func() {
run := podmanTest.Podman([]string{"run", "--net=host", "--hostname", hostname, ALPINE, "hostname"})
run.WaitWithDefaultTimeout()
Expect(run.ExitCode()).To(BeZero())
- Expect(strings.Contains(run.OutputToString(), "testctr")).To(BeTrue())
+ Expect(strings.Contains(run.OutputToString(), hostname)).To(BeTrue())
+ })
+
+ It("podman run with --net=none adds hostname to /etc/hosts", func() {
+ hostname := "testctr"
+ run := podmanTest.Podman([]string{"run", "--net=none", "--hostname", hostname, ALPINE, "hostname"})
+ run.WaitWithDefaultTimeout()
+ Expect(run.ExitCode()).To(BeZero())
+ Expect(strings.Contains(run.OutputToString(), hostname)).To(BeTrue())
})
})
diff --git a/test/e2e/run_security_labels.go b/test/e2e/run_security_labels.go
index 2a0b0467d..0c5621e3f 100644
--- a/test/e2e/run_security_labels.go
+++ b/test/e2e/run_security_labels.go
@@ -94,7 +94,7 @@ var _ = Describe("Podman generate kube", func() {
test1.WaitWithDefaultTimeout()
Expect(test1.ExitCode()).To(BeZero())
- commit := podmanTest.Podman([]string{"commit", "-c", "label=io.containers.capabilities=sys_chroot,net_raw", "test1", "image1"})
+ commit := podmanTest.Podman([]string{"commit", "-c", "label=io.containers.capabilities=sys_chroot,setuid", "test1", "image1"})
commit.WaitWithDefaultTimeout()
Expect(commit.ExitCode()).To(BeZero())
@@ -108,7 +108,7 @@ var _ = Describe("Podman generate kube", func() {
ctr := inspect.InspectContainerToJSON()
caps := strings.Join(ctr[0].EffectiveCaps, ",")
- Expect(caps).To(Equal("CAP_SYS_CHROOT,CAP_NET_RAW"))
+ Expect(caps).To(Equal("CAP_SYS_CHROOT,CAP_SETUID"))
})
diff --git a/test/e2e/run_volume_test.go b/test/e2e/run_volume_test.go
index 92d3418e3..1c8a67123 100644
--- a/test/e2e/run_volume_test.go
+++ b/test/e2e/run_volume_test.go
@@ -489,7 +489,7 @@ VOLUME /test/`
Expect(err).To(Not(BeNil()))
// Make sure modifications in container disappear when container is stopped
- session = podmanTest.Podman([]string{"create", "-d", "-v", fmt.Sprintf("%s:/run/test:O", mountPath), ALPINE, "top"})
+ session = podmanTest.Podman([]string{"create", "-v", fmt.Sprintf("%s:/run/test:O", mountPath), ALPINE, "top"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
session = podmanTest.Podman([]string{"start", "-l"})
diff --git a/test/e2e/start_test.go b/test/e2e/start_test.go
index 35b5cab6e..942e00123 100644
--- a/test/e2e/start_test.go
+++ b/test/e2e/start_test.go
@@ -40,7 +40,7 @@ var _ = Describe("Podman start", func() {
})
It("podman start single container by id", func() {
- session := podmanTest.Podman([]string{"create", "-d", ALPINE, "ls"})
+ session := podmanTest.Podman([]string{"create", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
cid := session.OutputToString()
@@ -50,7 +50,7 @@ var _ = Describe("Podman start", func() {
})
It("podman container start single container by id", func() {
- session := podmanTest.Podman([]string{"container", "create", "-d", ALPINE, "ls"})
+ session := podmanTest.Podman([]string{"container", "create", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
cid := session.OutputToString()
@@ -61,7 +61,7 @@ var _ = Describe("Podman start", func() {
})
It("podman container start single container by short id", func() {
- session := podmanTest.Podman([]string{"container", "create", "-d", ALPINE, "ls"})
+ session := podmanTest.Podman([]string{"container", "create", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
cid := session.OutputToString()
@@ -74,7 +74,7 @@ var _ = Describe("Podman start", func() {
It("podman start single container by name", func() {
name := "foobar99"
- session := podmanTest.Podman([]string{"create", "-d", "--name", name, ALPINE, "ls"})
+ session := podmanTest.Podman([]string{"create", "--name", name, ALPINE, "ls"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
session = podmanTest.Podman([]string{"start", name})
@@ -98,10 +98,10 @@ var _ = Describe("Podman start", func() {
})
It("podman start multiple containers", func() {
- session := podmanTest.Podman([]string{"create", "-d", "--name", "foobar99", ALPINE, "ls"})
+ session := podmanTest.Podman([]string{"create", "--name", "foobar99", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
cid1 := session.OutputToString()
- session2 := podmanTest.Podman([]string{"create", "-d", "--name", "foobar100", ALPINE, "ls"})
+ session2 := podmanTest.Podman([]string{"create", "--name", "foobar100", ALPINE, "ls"})
session2.WaitWithDefaultTimeout()
cid2 := session2.OutputToString()
session = podmanTest.Podman([]string{"start", cid1, cid2})
@@ -110,7 +110,7 @@ var _ = Describe("Podman start", func() {
})
It("podman start multiple containers with bogus", func() {
- session := podmanTest.Podman([]string{"create", "-d", "--name", "foobar99", ALPINE, "ls"})
+ session := podmanTest.Podman([]string{"create", "--name", "foobar99", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
cid1 := session.OutputToString()
session = podmanTest.Podman([]string{"start", cid1, "doesnotexist"})
diff --git a/test/e2e/stop_test.go b/test/e2e/stop_test.go
index 1437fd066..c25709a63 100644
--- a/test/e2e/stop_test.go
+++ b/test/e2e/stop_test.go
@@ -242,7 +242,7 @@ var _ = Describe("Podman stop", func() {
defer os.RemoveAll(tmpDir)
- session := podmanTest.Podman([]string{"create", "--cidfile", tmpFile, "-d", ALPINE, "top"})
+ session := podmanTest.Podman([]string{"create", "--cidfile", tmpFile, ALPINE, "top"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
cid := session.OutputToStringArray()[0]
diff --git a/test/e2e/systemd_test.go b/test/e2e/systemd_test.go
index 9e717a0eb..218c250cd 100644
--- a/test/e2e/systemd_test.go
+++ b/test/e2e/systemd_test.go
@@ -59,7 +59,7 @@ WantedBy=multi-user.target
Expect(stop.ExitCode()).To(Equal(0))
}()
- create := podmanTest.Podman([]string{"create", "-d", "--name", "redis", "redis"})
+ create := podmanTest.Podman([]string{"create", "--name", "redis", "redis"})
create.WaitWithDefaultTimeout()
Expect(create.ExitCode()).To(Equal(0))
diff --git a/test/system/250-systemd.bats b/test/system/250-systemd.bats
index 9bd3e15a1..ac3ae2f98 100644
--- a/test/system/250-systemd.bats
+++ b/test/system/250-systemd.bats
@@ -42,7 +42,7 @@ function teardown() {
cname=$(random_string)
# See #7407 for --pull=always.
- run_podman create --pull=always --name $cname --label "io.containers.autoupdate=image" --detach $IMAGE top
+ run_podman create --pull=always --name $cname --label "io.containers.autoupdate=image" $IMAGE top
run_podman generate systemd --new $cname
echo "$output" > "$UNIT_FILE"