Switch to Podman by default

Docker will be deprecated in Stein and removed in Train.

Change-Id: I7faaf0b120cc58c5f643da1c4ce186ad340b4710
This commit is contained in:
Emilien Macchi 2019-03-04 18:02:37 -05:00
parent 8c478a4600
commit e42b4690e6
5 changed files with 25 additions and 21 deletions

View File

@ -13,8 +13,7 @@ Utility to launch and manage containers using YAML based configuration data
Features
--------
* Single host only, operations are performed via the docker client on the
currently configured docker service.
* Single host only, operations are performed via the podman client.
* Zero external state, only labels on running containers are used when
determining which containers an operation will perform on.
* Single threaded and blocking, containers which are not configured to detach
@ -64,7 +63,7 @@ Applied by running:
$ echo hi >> paunch-state.txt
A container called ``hello`` will be created, print a Hello World message, then
exit. You can confirm that it still exists by running ``docker ps -a``.
exit. You can confirm that it still exists by running ``podman ps -a``.
Now lets try running the exact same ``paunch apply`` command:
@ -82,7 +81,7 @@ Lets try again with a unique --config-id:
$ paunch --verbose apply --file examples/hello-world.yml --config-id hi-again
$ echo hi-again >> paunch-state.txt
Doing a ``docker ps -a`` now will show that there are now 2 containers, one
Doing a ``podman ps -a`` now will show that there are now 2 containers, one
called ``hello`` and the other called ``hello-(random suffix)``. Lets delete the
one associated with the ``hi`` config-id:
@ -93,7 +92,7 @@ one associated with the ``hi`` config-id:
$ cat paunch-state.txt
$ paunch --verbose cleanup $(cat paunch-state.txt)
Doing a ``docker ps -a`` will show that the original ``hello`` container has been
Doing a ``podman ps -a`` will show that the original ``hello`` container has been
deleted and ``hello-(random suffix)`` has been renamed to ``hello``
Generally ``paunch cleanup`` will be run first to delete containers for configs
@ -158,7 +157,7 @@ container. This can be used to:
* Run a container with a specific configuration.
* Dump the configuration of a given container in either json or yaml.
* Output the docker command line used to start the container.
* Output the podman command line used to start the container.
* Run a container with any configuration additions you wish such that you can
run it with a shell as any user etc.

View File

@ -24,7 +24,7 @@ from paunch.utils import common
__version__ = pbr.version.VersionInfo('paunch').version_string()
def apply(config_id, config, managed_by, labels=None, cont_cmd='docker',
def apply(config_id, config, managed_by, labels=None, cont_cmd='podman',
default_runtime=None, log_level=None, log_file=None,
cont_log_path=None):
"""Execute supplied container configuration.
@ -77,7 +77,7 @@ def apply(config_id, config, managed_by, labels=None, cont_cmd='docker',
return builder.apply()
def cleanup(config_ids, managed_by, cont_cmd='docker', default_runtime=None,
def cleanup(config_ids, managed_by, cont_cmd='podman', default_runtime=None,
log_level=None, log_file=None):
"""Delete containers no longer applied, rename others to preferred name.
@ -106,7 +106,7 @@ def cleanup(config_ids, managed_by, cont_cmd='docker', default_runtime=None,
r.rename_containers()
def list(managed_by, cont_cmd='docker', default_runtime=None,
def list(managed_by, cont_cmd='podman', default_runtime=None,
log_level=None, log_file=None):
"""List all containers associated with all config IDs.
@ -118,7 +118,7 @@ def list(managed_by, cont_cmd='docker', default_runtime=None,
:param int log_file: optional log file for messages
:returns a dict where the key is the config ID and the value is a list of
'docker inspect' dicts for each container.
'podman inspect' dicts for each container.
:rtype: defaultdict(list)
"""
log = common.configure_logging(__name__, log_level, log_file)
@ -135,7 +135,7 @@ def list(managed_by, cont_cmd='docker', default_runtime=None,
def debug(config_id, container_name, action, config, managed_by, labels=None,
cont_cmd='docker', default_runtime=None, log_level=None,
cont_cmd='podman', default_runtime=None, log_level=None,
log_file=None):
"""Execute supplied container configuration.
@ -210,7 +210,7 @@ def debug(config_id, container_name, action, config, managed_by, labels=None,
'"print-cmd", or "run"')
def delete(config_ids, managed_by, cont_cmd='docker', default_runtime=None,
def delete(config_ids, managed_by, cont_cmd='podman', default_runtime=None,
log_level=None, log_file=None):
"""Delete containers with the specified config IDs.

View File

@ -61,7 +61,7 @@ class Apply(command.Command):
parser.add_argument(
'--default-runtime',
dest='default_runtime',
default='docker',
default='podman',
choices=['docker', 'podman'],
help=('Default runtime for containers. Can be docker or podman.'),
)
@ -122,7 +122,7 @@ class Cleanup(command.Command):
parser.add_argument(
'--default-runtime',
dest='default_runtime',
default='docker',
default='podman',
choices=['docker', 'podman'],
help=('Default runtime for containers. Can be docker or podman.'),
)
@ -162,7 +162,7 @@ class Delete(command.Command):
parser.add_argument(
'--default-runtime',
dest='default_runtime',
default='docker',
default='podman',
choices=['docker', 'podman'],
help=('Default runtime for containers. Can be docker or podman.'),
)
@ -264,7 +264,7 @@ class Debug(command.Command):
parser.add_argument(
'--default-runtime',
dest='default_runtime',
default='docker',
default='podman',
choices=['docker', 'podman'],
help=('Default runtime for containers. Can be docker or podman.'),
)
@ -336,7 +336,7 @@ class List(lister.Lister):
parser.add_argument(
'--default-runtime',
dest='default_runtime',
default='docker',
default='podman',
choices=['docker', 'podman'],
help=('Default runtime for containers. Can be docker or podman.'),
)

View File

@ -23,7 +23,7 @@ class TestPaunchDockerRuntime(base.TestCase):
@mock.patch('paunch.builder.compose1.ComposeV1Builder', autospec=True)
@mock.patch('paunch.runner.DockerRunner', autospec=True)
def test_apply(self, runner, builder):
paunch.apply('foo', {'bar': 'baz'}, 'tester')
paunch.apply('foo', {'bar': 'baz'}, 'tester', cont_cmd='docker')
runner.assert_called_once_with('tester', cont_cmd='docker',
log=mock.ANY)
builder.assert_called_once_with(
@ -41,6 +41,7 @@ class TestPaunchDockerRuntime(base.TestCase):
paunch.apply(
config_id='foo',
config={'bar': 'baz'},
cont_cmd='docker',
managed_by='tester',
labels={'bink': 'boop'})
@ -57,7 +58,7 @@ class TestPaunchDockerRuntime(base.TestCase):
@mock.patch('paunch.runner.DockerRunner', autospec=True)
def test_cleanup(self, runner):
paunch.cleanup(['foo', 'bar'], 'tester')
paunch.cleanup(['foo', 'bar'], 'tester', cont_cmd='docker')
runner.assert_called_once_with('tester', cont_cmd='docker',
log=mock.ANY)
runner.return_value.delete_missing_configs.assert_called_once_with(
@ -66,14 +67,14 @@ class TestPaunchDockerRuntime(base.TestCase):
@mock.patch('paunch.runner.DockerRunner', autospec=True)
def test_list(self, runner):
paunch.list('tester')
paunch.list('tester', cont_cmd='docker')
runner.assert_called_once_with('tester', cont_cmd='docker',
log=mock.ANY)
runner.return_value.list_configs.assert_called_once_with()
@mock.patch('paunch.runner.DockerRunner', autospec=True)
def test_delete(self, runner):
paunch.delete(['foo', 'bar'], 'tester')
paunch.delete(['foo', 'bar'], 'tester', cont_cmd='docker')
runner.assert_called_once_with('tester', cont_cmd='docker',
log=mock.ANY)
runner.return_value.remove_containers.assert_has_calls([

View File

@ -0,0 +1,4 @@
---
features:
- |
Podman is now the default container runtime, replacing Docker.