diff options
author | Matthew Heon <mheon@redhat.com> | 2021-01-12 14:29:27 -0500 |
---|---|---|
committer | Matthew Heon <mheon@redhat.com> | 2021-01-14 18:29:28 -0500 |
commit | 997de2f8e9e5453a99108bde012aa6c41d7323ec (patch) | |
tree | 499660321cf95f726636fcdd3dd4a8afbb86e2f5 /docs/source | |
parent | 2b7793b6121d336a285fb7b9a7612c221cbf63d2 (diff) | |
download | podman-997de2f8e9e5453a99108bde012aa6c41d7323ec.tar.gz podman-997de2f8e9e5453a99108bde012aa6c41d7323ec.tar.bz2 podman-997de2f8e9e5453a99108bde012aa6c41d7323ec.zip |
Initial implementation of renaming containers
Basic theory: We remove the container, but *only from the DB*.
We leave it in c/storage, we leave the lock allocated, we leave
it running (if it is). Then we create an identical container with
an altered name, and add that back to the database. Theoretically
we now have a renamed container.
The advantage of this approach is that it doesn't just apply to
rename - we can use this to make *any* configuration change to a
container that does not alter its container ID.
Potential problems are numerous. This process is *THOROUGHLY*
non-atomic at present - if you `kill -9` Podman mid-rename things
will be in a bad place, for example. Also, we can't rename
containers that can't be removed normally - IE, containers with
dependencies (pod infra containers, for example).
The largest potential improvement will be to move the majority of
the work into the DB, with a `RecreateContainer()` method - that
will add atomicity, and let us remove the container without
worrying about depencies and similar issues.
Potential problems: long-running processes that edit the DB and
may have an older version of the configuration around. Most
notable example is `podman run --rm` - the removal command needed
to be manually edited to avoid this one. This begins to get at
the heart of me not wanting to do this in the first place...
This provides CLI and API implementations for frontend, but no
tunnel implementation. It will be added in a future release (just
held back for time now - we need this in 3.0 and are running low
on time).
This is honestly kind of horrifying, but I think it will work.
Signed-off-by: Matthew Heon <mheon@redhat.com>
Diffstat (limited to 'docs/source')
-rw-r--r-- | docs/source/Commands.rst | 2 | ||||
-rw-r--r-- | docs/source/managecontainers.rst | 2 | ||||
-rw-r--r-- | docs/source/markdown/podman-container.1.md | 3 | ||||
-rw-r--r-- | docs/source/markdown/podman-rename.1.md | 38 | ||||
-rw-r--r-- | docs/source/markdown/podman.1.md | 3 |
5 files changed, 46 insertions, 2 deletions
diff --git a/docs/source/Commands.rst b/docs/source/Commands.rst index cd5d894da..563462377 100644 --- a/docs/source/Commands.rst +++ b/docs/source/Commands.rst @@ -75,6 +75,8 @@ Commands :doc:`push <markdown/podman-push.1>` Push an image to a specified destination +:doc:`rename <markdown/podman-rename.1>` Rename an existing container + :doc:`restart <markdown/podman-restart.1>` Restart one or more containers :doc:`rm <markdown/podman-rm.1>` Remove one or more containers diff --git a/docs/source/managecontainers.rst b/docs/source/managecontainers.rst index 9926f9996..9b3978f25 100644 --- a/docs/source/managecontainers.rst +++ b/docs/source/managecontainers.rst @@ -41,6 +41,8 @@ Manage Containers :doc:`ps <markdown/podman-ps.1>` List containers +:doc:`rename <markdown/podman-rename.1>` Rename an existing container + :doc:`restart <markdown/podman-restart.1>` Restart one or more containers :doc:`restore <markdown/podman-container-restore.1>` Restores one or more containers from a checkpoint diff --git a/docs/source/markdown/podman-container.1.md b/docs/source/markdown/podman-container.1.md index 9da5db601..e85d69c59 100644 --- a/docs/source/markdown/podman-container.1.md +++ b/docs/source/markdown/podman-container.1.md @@ -33,6 +33,7 @@ The container command allows you to manage containers | port | [podman-port(1)](podman-port.1.md) | List port mappings for the container. | | prune | [podman-container-prune(1)](podman-container-prune.1.md)| Remove all stopped containers from local storage. | | ps | [podman-ps(1)](podman-ps.1.md) | Prints out information about containers. | +| rename | [podman-rename(1)](podman-rename.1.md) | Rename an existing container. | | restart | [podman-restart(1)](podman-restart.1.md) | Restart one or more containers. | | restore | [podman-container-restore(1)](podman-container-restore.1.md) | Restores one or more containers from a checkpoint. | | rm | [podman-rm(1)](podman-rm.1.md) | Remove one or more containers. | @@ -42,7 +43,7 @@ The container command allows you to manage containers | stats | [podman-stats(1)](podman-stats.1.md) | Display a live stream of one or more container's resource usage statistics. | | stop | [podman-stop(1)](podman-stop.1.md) | Stop one or more running containers. | | top | [podman-top(1)](podman-top.1.md) | Display the running processes of a container. | -| unmount | [podman-unmount(1)](podman-unmount.1.md) | Unmount a working container's root filesystem.(Alias unmount) | +| unmount | [podman-unmount(1)](podman-unmount.1.md) | Unmount a working container's root filesystem.(Alias unmount) | | unpause | [podman-unpause(1)](podman-unpause.1.md) | Unpause one or more containers. | | wait | [podman-wait(1)](podman-wait.1.md) | Wait on one or more containers to stop and print their exit codes. | diff --git a/docs/source/markdown/podman-rename.1.md b/docs/source/markdown/podman-rename.1.md new file mode 100644 index 000000000..fdb0dac89 --- /dev/null +++ b/docs/source/markdown/podman-rename.1.md @@ -0,0 +1,38 @@ +% podman-rename(1) + +## NAME +podman\-rename - Rename an existing container + +## SYNOPSIS +**podman rename** *container* *newname* + +**podman container rename** *container* *newname* + +## DESCRIPTION +Rename changes the name of an existing container. +The old name will be freed, and will be available for use. +This command can be run on containers in any state. +However, running containers may not fully receive the effects until they are restarted - for example, a running container may still use the old name in its logs. +At present, only containers are supported; pods and volumes cannot be renamed. + +## OPTIONS + +## EXAMPLES + +``` +# Rename a container by name +$ podman rename oldContainer aNewName +``` + +``` +# Rename a container by ID +$ podman rename 717716c00a6b testcontainer +``` + +``` +# Use the container rename alias +$ podman container rename 6e7514b47180 databaseCtr +``` + +## SEE ALSO +podman(1), podman-create(1), podman-run(1) diff --git a/docs/source/markdown/podman.1.md b/docs/source/markdown/podman.1.md index 42054d075..67484c3ec 100644 --- a/docs/source/markdown/podman.1.md +++ b/docs/source/markdown/podman.1.md @@ -247,6 +247,7 @@ the exit codes follow the `chroot` standard, see below: | [podman-ps(1)](podman-ps.1.md) | Prints out information about containers. | | [podman-pull(1)](podman-pull.1.md) | Pull an image from a registry. | | [podman-push(1)](podman-push.1.md) | Push an image from local storage to elsewhere. | +| [podman-rename(1)](podman-rename.1.md) | Rename an existing container. | | [podman-restart(1)](podman-restart.1.md) | Restart one or more containers. | | [podman-rm(1)](podman-rm.1.md) | Remove one or more containers. | | [podman-rmi(1)](podman-rmi.1.md) | Removes one or more locally stored images. | @@ -259,7 +260,7 @@ the exit codes follow the `chroot` standard, see below: | [podman-system(1)](podman-system.1.md) | Manage podman. | | [podman-tag(1)](podman-tag.1.md) | Add an additional name to a local image. | | [podman-top(1)](podman-top.1.md) | Display the running processes of a container. | -| [podman-unmount(1)](podman-unmount.1.md) | Unmount a working container's root filesystem. | +| [podman-unmount(1)](podman-unmount.1.md) | Unmount a working container's root filesystem. | | [podman-unpause(1)](podman-unpause.1.md) | Unpause one or more containers. | | [podman-unshare(1)](podman-unshare.1.md) | Run a command inside of a modified user namespace. | | [podman-untag(1)](podman-untag.1.md) | Removes one or more names from a locally-stored image. | |