summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/source/markdown/podman.1.md8
-rwxr-xr-xhack/podman-socat4
-rw-r--r--libpod/boltdb_state.go6
-rw-r--r--libpod/boltdb_state_internal.go4
-rw-r--r--libpod/runtime_ctr.go4
-rw-r--r--libpod/runtime_img_test.go4
-rw-r--r--nix/nixpkgs.json8
-rw-r--r--pkg/api/handlers/compat/containers.go7
-rw-r--r--pkg/api/handlers/compat/images_build.go7
-rw-r--r--pkg/api/server/register_images.go2
-rw-r--r--pkg/domain/infra/abi/containers.go4
-rw-r--r--pkg/registries/registries.go5
-rw-r--r--test/apiv2/20-containers.at1
-rw-r--r--test/apiv2/rest_api/__init__.py4
-rw-r--r--test/e2e/libpod_suite_remote_test.go6
-rw-r--r--test/e2e/libpod_suite_test.go6
-rw-r--r--test/e2e/login_logout_test.go8
-rw-r--r--test/python/docker/__init__.py4
-rw-r--r--test/system/050-stop.bats2
19 files changed, 58 insertions, 36 deletions
diff --git a/docs/source/markdown/podman.1.md b/docs/source/markdown/podman.1.md
index 6f9e705c2..141d231f3 100644
--- a/docs/source/markdown/podman.1.md
+++ b/docs/source/markdown/podman.1.md
@@ -279,6 +279,8 @@ Distributions ship the `/usr/share/containers/containers.conf` file with their d
Podman uses builtin defaults if no containers.conf file is found.
+If the **CONTAINERS_CONF** environment variable is set, then its value is used for the containers.conf file rather than the default.
+
**mounts.conf** (`/usr/share/containers/mounts.conf`)
The mounts.conf file specifies volume mount directories that are automatically mounted inside containers when executing the `podman run` or `podman start` commands. Administrators can override the defaults file by creating `/etc/containers/mounts.conf`.
@@ -295,6 +297,8 @@ When Podman runs in rootless mode, the file `$HOME/.config/containers/mounts.con
Non root users of Podman can create the `$HOME/.config/containers/registries.conf` file to be used instead of the system defaults.
+ If the **CONTAINERS_REGISTRIES_CONF** environment variable is set, then its value is used for the registries.conf file rather than the default.
+
**storage.conf** (`/etc/containers/storage.conf`, `$HOME/.config/containers/storage.conf`)
storage.conf is the storage configuration file for all tools using containers/storage
@@ -303,8 +307,10 @@ When Podman runs in rootless mode, the file `$HOME/.config/containers/mounts.con
When Podman runs in rootless mode, the file `$HOME/.config/containers/storage.conf` is used instead of the system defaults.
+ If the **CONTAINERS_STORAGE_CONF** environment variable is set, the its value is used for the storage.conf file rather than the default.
+
## Rootless mode
-Podman can also be used as non-root user. When podman runs in rootless mode, a user namespace is automatically created for the user, defined in /etc/subuid and /etc/subgid.
+Podman can also be used as non-root user. When podman runs in rootless mode, a user namespace is automatically created for the user, defined in /etc/subuid and /etc/subgid.
Containers created by a non-root user are not visible to other users and are not seen or managed by Podman running as root.
diff --git a/hack/podman-socat b/hack/podman-socat
index 7bc571816..6ee6b89d8 100755
--- a/hack/podman-socat
+++ b/hack/podman-socat
@@ -54,8 +54,8 @@ trap "cleanup $TMPDIR" EXIT
# Need locations to store stuff
mkdir -p "${TMPDIR}"/{podman,crio,crio-run,cni/net.d,ctnr,tunnel}
-export REGISTRIES_CONFIG_PATH=${TMPDIR}/registry.conf
-cat >"$REGISTRIES_CONFIG_PATH" <<-EOT
+export CONTAINERS_REGISTRIES_CONF=${TMPDIR}/registry.conf
+cat >"$CONTAINERS_REGISTRIES_CONF" <<-EOT
[registries.search]
registries = ['docker.io']
[registries.insecure]
diff --git a/libpod/boltdb_state.go b/libpod/boltdb_state.go
index 122dd080f..5df3e8961 100644
--- a/libpod/boltdb_state.go
+++ b/libpod/boltdb_state.go
@@ -879,7 +879,7 @@ func (s *BoltState) ContainerInUse(ctr *Container) ([]string, error) {
ctrDB := ctrBucket.Bucket([]byte(ctr.ID()))
if ctrDB == nil {
ctr.valid = false
- return errors.Wrapf(define.ErrNoSuchCtr, "no container with ID %s found in DB", ctr.ID())
+ return errors.Wrapf(define.ErrNoSuchCtr, "no container with ID %q found in DB", ctr.ID())
}
dependsBkt := ctrDB.Bucket(dependenciesBkt)
@@ -1669,7 +1669,7 @@ func (s *BoltState) RewriteContainerConfig(ctr *Container, newCfg *ContainerConf
ctrDB := ctrBkt.Bucket([]byte(ctr.ID()))
if ctrDB == nil {
ctr.valid = false
- return errors.Wrapf(define.ErrNoSuchCtr, "no container with ID %s found in DB", ctr.ID())
+ return errors.Wrapf(define.ErrNoSuchCtr, "no container with ID %q found in DB", ctr.ID())
}
if err := ctrDB.Put(configKey, newCfgJSON); err != nil {
@@ -1767,7 +1767,7 @@ func (s *BoltState) SafeRewriteContainerConfig(ctr *Container, oldName, newName
ctrDB := ctrBkt.Bucket([]byte(ctr.ID()))
if ctrDB == nil {
ctr.valid = false
- return errors.Wrapf(define.ErrNoSuchCtr, "no container with ID %s found in DB", ctr.ID())
+ return errors.Wrapf(define.ErrNoSuchCtr, "no container with ID %q found in DB", ctr.ID())
}
if err := ctrDB.Put(configKey, newCfgJSON); err != nil {
diff --git a/libpod/boltdb_state_internal.go b/libpod/boltdb_state_internal.go
index cf8f1c175..d4994334f 100644
--- a/libpod/boltdb_state_internal.go
+++ b/libpod/boltdb_state_internal.go
@@ -1055,9 +1055,9 @@ func (s *BoltState) lookupContainerID(idOrName string, ctrBucket, namesBucket, n
return nil, err
} else if !exists {
if isPod {
- return nil, errors.Wrapf(define.ErrNoSuchCtr, "%s is a pod, not a container", idOrName)
+ return nil, errors.Wrapf(define.ErrNoSuchCtr, "%q is a pod, not a container", idOrName)
}
- return nil, errors.Wrapf(define.ErrNoSuchCtr, "no container with name or ID %s found", idOrName)
+ return nil, errors.Wrapf(define.ErrNoSuchCtr, "no container with name or ID %q found", idOrName)
}
return id, nil
}
diff --git a/libpod/runtime_ctr.go b/libpod/runtime_ctr.go
index 661ca7ff8..19690d79b 100644
--- a/libpod/runtime_ctr.go
+++ b/libpod/runtime_ctr.go
@@ -714,7 +714,7 @@ func (r *Runtime) evictContainer(ctx context.Context, idOrName string, removeVol
id, err := r.state.LookupContainerID(idOrName)
if err != nil {
- return "", errors.Wrapf(err, "failed to find container %q in state", idOrName)
+ return "", err
}
// Begin by trying a normal removal. Valid containers will be removed normally.
@@ -744,7 +744,7 @@ func (r *Runtime) evictContainer(ctx context.Context, idOrName string, removeVol
return id, err
}
if !exists {
- return id, errors.Wrapf(err, "failed to find container ID %q for eviction", id)
+ return id, err
}
// Re-create a container struct for removal purposes
diff --git a/libpod/runtime_img_test.go b/libpod/runtime_img_test.go
index 7d6390c85..c25f3f08c 100644
--- a/libpod/runtime_img_test.go
+++ b/libpod/runtime_img_test.go
@@ -37,7 +37,7 @@ func TestGetRegistries(t *testing.T) {
registryPath, err := createTmpFile([]byte(registry))
assert.NoError(t, err)
defer os.Remove(registryPath)
- os.Setenv("REGISTRIES_CONFIG_PATH", registryPath)
+ os.Setenv("CONTAINERS_REGISTRIES_CONF", registryPath)
registries, err := sysreg.GetRegistries()
assert.NoError(t, err)
assert.True(t, reflect.DeepEqual(registries, []string{"one"}))
@@ -46,7 +46,7 @@ func TestGetRegistries(t *testing.T) {
func TestGetInsecureRegistries(t *testing.T) {
registryPath, err := createTmpFile([]byte(registry))
assert.NoError(t, err)
- os.Setenv("REGISTRIES_CONFIG_PATH", registryPath)
+ os.Setenv("CONTAINERS_REGISTRIES_CONF", registryPath)
defer os.Remove(registryPath)
registries, err := sysreg.GetInsecureRegistries()
assert.NoError(t, err)
diff --git a/nix/nixpkgs.json b/nix/nixpkgs.json
index 459fb28f8..cc8daf55c 100644
--- a/nix/nixpkgs.json
+++ b/nix/nixpkgs.json
@@ -1,9 +1,9 @@
{
"url": "https://github.com/nixos/nixpkgs",
- "rev": "30c2fb65feaf1068b1c413a0b75470afd351c291",
- "date": "2021-01-28T21:27:34-05:00",
- "path": "/nix/store/zk71rlw37vg9hqc5j0vqi9x8qzb2ir0m-nixpkgs",
- "sha256": "0b1y1lgzbagpgh9cvi9szkm162laifz0q2ss4pibns3j3gqpf5gl",
+ "rev": "f38b9b258f3f4db5ecf7dd27a7d5b48f23202843",
+ "date": "2021-03-07T14:22:16+01:00",
+ "path": "/nix/store/df3v1b2qfsbnsd6fwaw4787qdy5rcxkc-nixpkgs",
+ "sha256": "1dbi7rjyfkv3rw6zqwbc6jknbdgyv16cd8zgcpq5gdj0mwnp9b13",
"fetchSubmodules": false,
"deepClone": false,
"leaveDotGit": false
diff --git a/pkg/api/handlers/compat/containers.go b/pkg/api/handlers/compat/containers.go
index d26bb50f4..d3277b815 100644
--- a/pkg/api/handlers/compat/containers.go
+++ b/pkg/api/handlers/compat/containers.go
@@ -76,7 +76,12 @@ func RemoveContainer(w http.ResponseWriter, r *http.Request) {
return
}
if len(report) > 0 && report[0].Err != nil {
- utils.InternalServerError(w, report[0].Err)
+ err = report[0].Err
+ if errors.Cause(err) == define.ErrNoSuchCtr {
+ utils.ContainerNotFound(w, name, err)
+ return
+ }
+ utils.InternalServerError(w, err)
return
}
diff --git a/pkg/api/handlers/compat/images_build.go b/pkg/api/handlers/compat/images_build.go
index 392f688dd..7751b91a7 100644
--- a/pkg/api/handlers/compat/images_build.go
+++ b/pkg/api/handlers/compat/images_build.go
@@ -445,6 +445,13 @@ loop:
logrus.Warnf("Failed to json encode error %v", err)
}
flush()
+ for _, tag := range query.Tag {
+ m.Stream = fmt.Sprintf("Successfully tagged %s\n", tag)
+ if err := enc.Encode(m); err != nil {
+ logrus.Warnf("Failed to json encode error %v", err)
+ }
+ flush()
+ }
}
}
break loop
diff --git a/pkg/api/server/register_images.go b/pkg/api/server/register_images.go
index f6a8a37ca..3d86e5d38 100644
--- a/pkg/api/server/register_images.go
+++ b/pkg/api/server/register_images.go
@@ -652,6 +652,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// example: |
// (build details...)
// Successfully built 8ba084515c724cbf90d447a63600c0a6
+ // Successfully tagged your_image:latest
// 400:
// $ref: "#/responses/BadParamError"
// 500:
@@ -1485,7 +1486,6 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// description: output from build process
// example: |
// (build details...)
- // Successfully built 8ba084515c724cbf90d447a63600c0a6
// 400:
// $ref: "#/responses/BadParamError"
// 500:
diff --git a/pkg/domain/infra/abi/containers.go b/pkg/domain/infra/abi/containers.go
index 4790bd58c..637531ee9 100644
--- a/pkg/domain/infra/abi/containers.go
+++ b/pkg/domain/infra/abi/containers.go
@@ -301,14 +301,14 @@ func (ic *ContainerEngine) ContainerRm(ctx context.Context, namesOrIds []string,
for _, ctr := range names {
logrus.Debugf("Evicting container %q", ctr)
report := entities.RmReport{Id: ctr}
- id, err := ic.Libpod.EvictContainer(ctx, ctr, options.Volumes)
+ _, err := ic.Libpod.EvictContainer(ctx, ctr, options.Volumes)
if err != nil {
if options.Ignore && errors.Cause(err) == define.ErrNoSuchCtr {
logrus.Debugf("Ignoring error (--allow-missing): %v", err)
reports = append(reports, &report)
continue
}
- report.Err = errors.Wrapf(err, "failed to evict container: %q", id)
+ report.Err = err
reports = append(reports, &report)
continue
}
diff --git a/pkg/registries/registries.go b/pkg/registries/registries.go
index bf5dee2ce..34c9138e3 100644
--- a/pkg/registries/registries.go
+++ b/pkg/registries/registries.go
@@ -24,7 +24,10 @@ var userRegistriesFile = filepath.Join(os.Getenv("HOME"), ".config/containers/re
// FIXME: This should be centralized in a global SystemContext initializer inherited throughout the code,
// not haphazardly called throughout the way it is being called now.
func SystemRegistriesConfPath() string {
- if envOverride := os.Getenv("REGISTRIES_CONFIG_PATH"); len(envOverride) > 0 {
+ if envOverride, ok := os.LookupEnv("CONTAINERS_REGISTRIES_CONF"); ok {
+ return envOverride
+ }
+ if envOverride, ok := os.LookupEnv("REGISTRIES_CONFIG_PATH"); ok {
return envOverride
}
diff --git a/test/apiv2/20-containers.at b/test/apiv2/20-containers.at
index 834ff5160..478717700 100644
--- a/test/apiv2/20-containers.at
+++ b/test/apiv2/20-containers.at
@@ -166,6 +166,7 @@ t DELETE images/localhost/newrepo:v1?force=true 200
t DELETE images/localhost/newrepo:v2?force=true 200
t DELETE libpod/containers/$cid 204
t DELETE libpod/containers/myctr 204
+t DELETE libpod/containers/bogus 404
# test apiv2 create container with correct entrypoint and cmd
diff --git a/test/apiv2/rest_api/__init__.py b/test/apiv2/rest_api/__init__.py
index db0257f03..b7b8a7649 100644
--- a/test/apiv2/rest_api/__init__.py
+++ b/test/apiv2/rest_api/__init__.py
@@ -27,7 +27,7 @@ class Podman(object):
self.cmd.append("--root=" + os.path.join(self.anchor_directory, "crio"))
self.cmd.append("--runroot=" + os.path.join(self.anchor_directory, "crio-run"))
- os.environ["REGISTRIES_CONFIG_PATH"] = os.path.join(self.anchor_directory, "registry.conf")
+ os.environ["CONTAINERS_REGISTRIES_CONF"] = os.path.join(self.anchor_directory, "registry.conf")
p = configparser.ConfigParser()
p.read_dict(
{
@@ -36,7 +36,7 @@ class Podman(object):
"registries.block": {"registries": "[]"},
}
)
- with open(os.environ["REGISTRIES_CONFIG_PATH"], "w") as w:
+ with open(os.environ["CONTAINERS_REGISTRIES_CONF"], "w") as w:
p.write(w)
os.environ["CNI_CONFIG_PATH"] = os.path.join(self.anchor_directory, "cni", "net.d")
diff --git a/test/e2e/libpod_suite_remote_test.go b/test/e2e/libpod_suite_remote_test.go
index a26765ee9..3115c246f 100644
--- a/test/e2e/libpod_suite_remote_test.go
+++ b/test/e2e/libpod_suite_remote_test.go
@@ -48,17 +48,17 @@ func (p *PodmanTestIntegration) PodmanExtraFiles(args []string, extraFiles []*os
func (p *PodmanTestIntegration) setDefaultRegistriesConfigEnv() {
defaultFile := filepath.Join(INTEGRATION_ROOT, "test/registries.conf")
- os.Setenv("REGISTRIES_CONFIG_PATH", defaultFile)
+ os.Setenv("CONTAINERS_REGISTRIES_CONF", defaultFile)
}
func (p *PodmanTestIntegration) setRegistriesConfigEnv(b []byte) {
outfile := filepath.Join(p.TempDir, "registries.conf")
- os.Setenv("REGISTRIES_CONFIG_PATH", outfile)
+ os.Setenv("CONTAINERS_REGISTRIES_CONF", outfile)
ioutil.WriteFile(outfile, b, 0644)
}
func resetRegistriesConfigEnv() {
- os.Setenv("REGISTRIES_CONFIG_PATH", "")
+ os.Setenv("CONTAINERS_REGISTRIES_CONF", "")
}
func PodmanTestCreate(tempDir string) *PodmanTestIntegration {
pti := PodmanTestCreateUtil(tempDir, true)
diff --git a/test/e2e/libpod_suite_test.go b/test/e2e/libpod_suite_test.go
index 0ae30ca10..cc03ccc96 100644
--- a/test/e2e/libpod_suite_test.go
+++ b/test/e2e/libpod_suite_test.go
@@ -31,17 +31,17 @@ func (p *PodmanTestIntegration) PodmanExtraFiles(args []string, extraFiles []*os
func (p *PodmanTestIntegration) setDefaultRegistriesConfigEnv() {
defaultFile := filepath.Join(INTEGRATION_ROOT, "test/registries.conf")
- os.Setenv("REGISTRIES_CONFIG_PATH", defaultFile)
+ os.Setenv("CONTAINERS_REGISTRIES_CONF", defaultFile)
}
func (p *PodmanTestIntegration) setRegistriesConfigEnv(b []byte) {
outfile := filepath.Join(p.TempDir, "registries.conf")
- os.Setenv("REGISTRIES_CONFIG_PATH", outfile)
+ os.Setenv("CONTAINERS_REGISTRIES_CONF", outfile)
ioutil.WriteFile(outfile, b, 0644)
}
func resetRegistriesConfigEnv() {
- os.Setenv("REGISTRIES_CONFIG_PATH", "")
+ os.Setenv("CONTAINERS_REGISTRIES_CONF", "")
}
func PodmanTestCreate(tempDir string) *PodmanTestIntegration {
diff --git a/test/e2e/login_logout_test.go b/test/e2e/login_logout_test.go
index 99876de29..6269bb92b 100644
--- a/test/e2e/login_logout_test.go
+++ b/test/e2e/login_logout_test.go
@@ -125,15 +125,15 @@ var _ = Describe("Podman login and logout", func() {
// Environment is per-process, so this looks very unsafe; actually it seems fine because tests are not
// run in parallel unless they opt in by calling t.Parallel(). So don’t do that.
- oldRCP, hasRCP := os.LookupEnv("REGISTRIES_CONFIG_PATH")
+ oldRCP, hasRCP := os.LookupEnv("CONTAINERS_REGISTRIES_CONF")
defer func() {
if hasRCP {
- os.Setenv("REGISTRIES_CONFIG_PATH", oldRCP)
+ os.Setenv("CONTAINERS_REGISTRIES_CONF", oldRCP)
} else {
- os.Unsetenv("REGISTRIES_CONFIG_PATH")
+ os.Unsetenv("CONTAINERS_REGISTRIES_CONF")
}
}()
- os.Setenv("REGISTRIES_CONFIG_PATH", registriesConf.Name())
+ os.Setenv("CONTAINERS_REGISTRIES_CONF", registriesConf.Name())
session := podmanTest.Podman([]string{"login", "-u", "podmantest", "-p", "test"})
session.WaitWithDefaultTimeout()
diff --git a/test/python/docker/__init__.py b/test/python/docker/__init__.py
index da5630eac..59b7987f4 100644
--- a/test/python/docker/__init__.py
+++ b/test/python/docker/__init__.py
@@ -39,7 +39,7 @@ class Podman(object):
self.cmd.append("--root=" + os.path.join(self.anchor_directory, "crio"))
self.cmd.append("--runroot=" + os.path.join(self.anchor_directory, "crio-run"))
- os.environ["REGISTRIES_CONFIG_PATH"] = os.path.join(
+ os.environ["CONTAINERS_REGISTRIES_CONF"] = os.path.join(
self.anchor_directory, "registry.conf"
)
p = configparser.ConfigParser()
@@ -50,7 +50,7 @@ class Podman(object):
"registries.block": {"registries": "[]"},
}
)
- with open(os.environ["REGISTRIES_CONFIG_PATH"], "w") as w:
+ with open(os.environ["CONTAINERS_REGISTRIES_CONF"], "w") as w:
p.write(w)
os.environ["CNI_CONFIG_PATH"] = os.path.join(
diff --git a/test/system/050-stop.bats b/test/system/050-stop.bats
index 7d9f1fcb3..0652a97e4 100644
--- a/test/system/050-stop.bats
+++ b/test/system/050-stop.bats
@@ -66,7 +66,7 @@ load helpers
name=thiscontainerdoesnotexist
run_podman 125 stop $name
is "$output" \
- "Error: no container with name or ID $name found: no such container" \
+ "Error: no container with name or ID \"$name\" found: no such container" \
"podman stop nonexistent container"
run_podman stop --ignore $name