Split out the code that calls 'podman start'

A subsequent commit will leverage this to detect 'podman start'
failures caused by attempting to run runc-based toolbox containers on
cgroups v2 sytems, and try to migrate them if possible.

https://github.com/containers/toolbox/pull/309
This commit is contained in:
Debarshi Ray 2019-10-25 17:51:12 +02:00
parent 359fae59be
commit 3496029ed7

19
toolbox
View file

@ -245,6 +245,19 @@ container_name_is_valid()
)
container_start()
(
container="$1"
if ! podman start "$container" >/dev/null 2>&3; then
echo "$base_toolbox_command: failed to start container $container" >&2
return 1
fi
return 0
)
copy_etc_profile_d_toolbox_to_container()
(
container="$1"
@ -1336,8 +1349,7 @@ run()
if is_etc_profile_d_toolbox_a_bind_mount "$toolbox_container"; then
echo "$base_toolbox_command: /etc/profile.d/toolbox.sh already mounted in container $toolbox_container" >&3
if ! podman start "$toolbox_container" >/dev/null 2>&3; then
echo "$base_toolbox_command: failed to start container $toolbox_container" >&2
if ! container_start "$toolbox_container"; then
exit 1
fi
else
@ -1347,8 +1359,7 @@ run()
exit 1
fi
if ! podman start "$toolbox_container" >/dev/null 2>&3; then
echo "$base_toolbox_command: failed to start container $toolbox_container" >&2
if ! container_start "$toolbox_container"; then
exit 1
fi