Repository: Stratoscale/skipper

Issue:
Move docker config to another folder

Discussion:

Patch:
diff --git a/.gitignore b/.gitignore
index 281342a..51a36a2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -16,3 +16,4 @@ venv
 MANIFEST
 reports
 **/RCS/**
+.venv
\ No newline at end of file
diff --git a/.pylintrc b/.pylintrc
index 156aeab..b29eff3 100644
--- a/.pylintrc
+++ b/.pylintrc
@@ -270,6 +270,9 @@ ignore-imports=no
 # Maximum number of arguments for function / method
 max-args=8
 
+# Maximum number of positional arguments (see R0917).
+max-positional-arguments = 12
+
 # Argument names that match this expression will be ignored. Default to name
 # with leading underscore
 ignored-argument-names=_.*
diff --git a/skipper/cli.py b/skipper/cli.py
index 5d58711..42b2553 100644
--- a/skipper/cli.py
+++ b/skipper/cli.py
@@ -137,21 +137,23 @@ def build(ctx, images_to_build, container_context, cache):
 @click.option('--namespace', help='Namespace to push into')
 @click.option('--force', help="Push image even if it's already in the registry", is_flag=True, default=False)
 @click.option('--pbr', help="Use PBR to tag the image", is_flag=True, default=False)
+@click.option('--tag', help="Tag to push", default=None)
 @click.argument('image')
 @click.pass_context
-def push(ctx, namespace, force, pbr, image):
+def push(ctx, namespace, force, pbr, tag, image):
     """
     Push a container
     """
     utils.logger.debug("Executing push command")
     _validate_global_params(ctx, 'registry')
-    tag = git.get_hash()
-    tag_to_push = tag
-    if pbr:
+    image_tag = git.get_hash()
+    tag_to_push = tag or image_tag
+    if not tag and pbr:
         # Format = pbr_version.short_hash
         # pylint: disable=protected-access
         tag_to_push = f"{packaging._get_version_from_git().replace('dev', '')}.{tag[:8]}"
-    image_name = image + ':' + tag
+
+    image_name = image + ':' + image_tag
 
     ret = _push(ctx, force, image, image_name, namespace, tag_to_push)
     if ret != 0:
diff --git a/skipper/runner.py b/skipper/runner.py
index 20da234..5cd63bc 100644
--- a/skipper/runner.py
+++ b/skipper/runner.py
@@ -8,6 +8,7 @@ from contextlib import contextmanager
 import sys
 from retry import retry
 from skipper import utils
+from skipper.utils import DOCKER_CONFIG
 
 
 def get_default_net():
@@ -17,6 +18,7 @@ def get_default_net():
 
 
 # pylint: disable=too-many-arguments
+# pylint: disable=too-many-positional-arguments
 def run(command, fqdn_image=None, environment=None, interactive=False, name=None, net=None, publish=(), volumes=None,
         workdir=None, use_cache=False, workspace=None, env_file=(), stdout_to_stderr=False):
 
@@ -44,7 +46,9 @@ def _run(cmd_args, stdout_to_stderr=False):
 
 
 # pylint: disable=too-many-locals
+# pylint: disable=too-many-branches
 # pylint: disable=too-many-arguments
+# pylint: disable=too-many-positional-arguments
 def _run_nested(fqdn_image, environment, command, interactive, name, net, publish, volumes, workdir, use_cache, workspace, env_file):
     cwd = os.getcwd()
     if workspace is None:
@@ -86,6 +90,12 @@ def _run_nested(fqdn_image, environment, command, interactive, name, net, publis
     cmd += ['-e', f'CONTAINER_RUNTIME_COMMAND={utils.get_runtime_command()}']
 
     if utils.get_runtime_command() == "docker":
+        if not utils.is_environment_variable_defined('DOCKER_CONFIG', environment):
+            cmd += ['-e', f'DOCKER_CONFIG={DOCKER_CONFIG}']
+
+        if not utils.is_environment_variable_defined('DOCKER_CONTEXT', environment):
+            cmd += ['-e', 'DOCKER_CONTEXT=default']
+
         try:
             docker_gid = grp.getgrnam('docker').gr_gid
             cmd += ['-e', f'SKIPPER_DOCKER_GID={docker_gid}']
@@ -136,12 +146,12 @@ def handle_volumes_bind_mount(docker_cmd, homedir, volumes, workspace):
     volumes.extend([f'{homedir}/.netrc:{homedir}/.netrc:ro',
                     f'{homedir}/.gitconfig:{homedir}/.gitconfig:ro'])
 
-    # required for docker buildkit and credentials
-    docker_folder = f'{homedir}/.docker'
-    if not any(f'{docker_folder}:{docker_folder}' in volume for volume in volumes):
-        _add_path_if_exists(docker_folder, docker_folder, 'rw', volumes)
+    # required for docker credentials
+    docker_config_folder = f'{homedir}/.docker/config.json'
+    if not any(f'{docker_config_folder}:' in volume for volume in volumes):
+        _add_path_if_exists(docker_config_folder, f'{DOCKER_CONFIG}/config.json', 'rw', volumes)
 
-    # required for docker login (certificates)
+    # required for docker certificates
     _add_path_if_exists('/etc/docker', '/etc/docker', 'ro', volumes)
 
     if utils.get_runtime_command() == utils.PODMAN:
diff --git a/skipper/utils.py b/skipper/utils.py
index d9c989f..45d1407 100644
--- a/skipper/utils.py
+++ b/skipper/utils.py
@@ -21,6 +21,7 @@ PODMAN = "podman"
 logger = None   # pylint: disable=invalid-name
 
 CONTAINER_RUNTIME_COMMAND = os.getenv("CONTAINER_RUNTIME_COMMAND")
+DOCKER_CONFIG = "/opt/.docker"
 
 SKIPPER_ULIMIT = [['--ulimit', limit] for limit in os.environ.get('SKIPPER_ULIMITS', 'nofile=65536:65536').split(',')]
 
@@ -211,3 +212,7 @@ def set_remote_registry_login_info(registry, ctx_object):
     except Exception:  # pylint: disable=broad-except
         #  Ignore failure and just continue
         pass
+
+
+def is_environment_variable_defined(name, environment):
+    return any(name in env_var for env_var in environment)


Test patch:
diff --git a/tests/test_runner.py b/tests/test_runner.py
index a0aeebc..969f00a 100644
--- a/tests/test_runner.py
+++ b/tests/test_runner.py
@@ -5,6 +5,7 @@ import mock
 from skipper import utils
 from skipper import runner
 from skipper.runner import get_default_net
+from skipper.utils import DOCKER_CONFIG
 
 USER_ID = 1000
 GROUP_ID = 2000
@@ -32,6 +33,7 @@ def get_volume_mapping(volume_mapping):
     return volume_mapping
 
 
+@mock.patch('skipper.runner._network_exists', mock.MagicMock(autospec=True, return_value=True))
 class TestRunner(unittest.TestCase):
 
     NET_LS = 'NETWORK ID          NAME                DRIVER              SCOPE\n' \
@@ -89,10 +91,13 @@ class TestRunner(unittest.TestCase):
             '-e', 'SKIPPER_UID=%(user_uid)s' % dict(user_uid=USER_ID),
             '-e', 'HOME=%(homedir)s' % dict(homedir=HOME_DIR),
             '-e', 'CONTAINER_RUNTIME_COMMAND=%(runtime_command)s' % dict(runtime_command=utils.get_runtime_command()),
+            '-e', 'DOCKER_CONFIG=/opt/.docker',
+            '-e', 'DOCKER_CONTEXT=default',
             '-e', 'SKIPPER_DOCKER_GID=978',
             '-v', get_volume_mapping('%(homedir)s/.netrc:%(homedir)s/.netrc:ro' % dict(homedir=HOME_DIR)),
             '-v', get_volume_mapping('%(homedir)s/.gitconfig:%(homedir)s/.gitconfig:ro' % dict(homedir=HOME_DIR)),
-            '-v', get_volume_mapping('%(homedir)s/.docker:%(homedir)s/.docker:rw' % dict(homedir=HOME_DIR)),
+            '-v', get_volume_mapping('%(homedir)s/.docker/config.json:%(docker_config)s/config.json:rw' % dict(
+                homedir=HOME_DIR, docker_config=DOCKER_CONFIG)),
             '-v', get_volume_mapping('/etc/docker:/etc/docker:ro'),
             '-v', get_volume_mapping('%(workdir)s:%(workdir)s:rw' % dict(workdir=WORKDIR)),
             '-v', get_volume_mapping('/var/run/docker.sock:/var/run/docker.sock:rw'),
@@ -135,10 +140,13 @@ class TestRunner(unittest.TestCase):
             '-e', 'SKIPPER_UID=%(user_uid)s' % dict(user_uid=USER_ID),
             '-e', 'HOME=%(homedir)s' % dict(homedir=HOME_DIR),
             '-e', 'CONTAINER_RUNTIME_COMMAND=%(runtime_command)s' % dict(runtime_command=utils.get_runtime_command()),
+            '-e', 'DOCKER_CONFIG=/opt/.docker',
+            '-e', 'DOCKER_CONTEXT=default',
             '-e', 'SKIPPER_DOCKER_GID=978',
             '-v', get_volume_mapping('%(homedir)s/.netrc:%(homedir)s/.netrc:ro' % dict(homedir=HOME_DIR)),
             '-v', get_volume_mapping('%(homedir)s/.gitconfig:%(homedir)s/.gitconfig:ro' % dict(homedir=HOME_DIR)),
-            '-v', get_volume_mapping('%(homedir)s/.docker:%(homedir)s/.docker:rw' % dict(homedir=HOME_DIR)),
+            '-v', get_volume_mapping('%(homedir)s/.docker/config.json:%(docker_config)s/config.json:rw' % dict(
+                homedir=HOME_DIR, docker_config=DOCKER_CONFIG)),
             '-v', get_volume_mapping('/etc/docker:/etc/docker:ro'),
             '-v', get_volume_mapping('%(workdir)s:%(workdir)s:rw' % dict(workdir=WORKDIR)),
             '-v', get_volume_mapping('/var/run/docker.sock:/var/run/docker.sock:rw'),
@@ -182,10 +190,13 @@ class TestRunner(unittest.TestCase):
             '-e', 'SKIPPER_UID=%(user_uid)s' % dict(user_uid=USER_ID),
             '-e', 'HOME=%(homedir)s' % dict(homedir=HOME_DIR),
             '-e', 'CONTAINER_RUNTIME_COMMAND=%(runtime_command)s' % dict(runtime_command=utils.get_runtime_command()),
+            '-e', 'DOCKER_CONFIG=/opt/.docker',
+            '-e', 'DOCKER_CONTEXT=default',
             '-e', 'SKIPPER_DOCKER_GID=978',
             '-v', get_volume_mapping('%(homedir)s/.netrc:%(homedir)s/.netrc:ro' % dict(homedir=HOME_DIR)),
             '-v', get_volume_mapping('%(homedir)s/.gitconfig:%(homedir)s/.gitconfig:ro' % dict(homedir=HOME_DIR)),
-            '-v', get_volume_mapping('%(homedir)s/.docker:%(homedir)s/.docker:rw' % dict(homedir=HOME_DIR)),
+            '-v', get_volume_mapping('%(homedir)s/.docker/config.json:%(docker_config)s/config.json:rw' % dict(
+                homedir=HOME_DIR, docker_config=DOCKER_CONFIG)),
             '-v', get_volume_mapping('/etc/docker:/etc/docker:ro'),
             '-v', get_volume_mapping('%(workdir)s:%(workdir)s:rw' % dict(workdir=WORKDIR)),
             '-v', get_volume_mapping('/var/run/docker.sock:/var/run/docker.sock:rw'),
@@ -236,12 +247,15 @@ class TestRunner(unittest.TestCase):
             '-e', 'SKIPPER_UID=%(user_uid)s' % dict(user_uid=USER_ID),
             '-e', 'HOME=%(homedir)s' % dict(homedir=HOME_DIR),
             '-e', 'CONTAINER_RUNTIME_COMMAND=%(runtime_command)s' % dict(runtime_command=utils.get_runtime_command()),
+            '-e', 'DOCKER_CONFIG=/opt/.docker',
+            '-e', 'DOCKER_CONTEXT=default',
             '-e', 'SKIPPER_DOCKER_GID=978',
             '-v', get_volume_mapping('%(homedir)s/.netrc:%(homedir)s/.netrc:ro' % dict(
                 homedir=HOME_DIR)),
             '-v', get_volume_mapping('%(homedir)s/.gitconfig:%(homedir)s/.gitconfig:ro' % dict(
                 homedir=HOME_DIR)),
-            '-v', get_volume_mapping('%(homedir)s/.docker:%(homedir)s/.docker:rw' % dict(homedir=HOME_DIR)),
+            '-v', get_volume_mapping('%(homedir)s/.docker/config.json:%(docker_config)s/config.json:rw' % dict(
+                homedir=HOME_DIR, docker_config=DOCKER_CONFIG)),
             '-v', get_volume_mapping('/etc/docker:/etc/docker:ro'),
             '-v', get_volume_mapping('%(workdir)s:%(workdir)s:rw' % dict(workdir=WORKDIR)),
             '-v', get_volume_mapping('/var/run/docker.sock:/var/run/docker.sock:rw'),
@@ -293,13 +307,15 @@ class TestRunner(unittest.TestCase):
             '-e', 'SKIPPER_UID=%(user_uid)s' % dict(user_uid=USER_ID),
             '-e', 'HOME=%(homedir)s' % dict(homedir=HOME_DIR),
             '-e', 'CONTAINER_RUNTIME_COMMAND=%(runtime_command)s' % dict(runtime_command=utils.get_runtime_command()),
+            '-e', 'DOCKER_CONFIG=/opt/.docker',
+            '-e', 'DOCKER_CONTEXT=default',
             '-e', 'SKIPPER_DOCKER_GID=978',
             '-v', '%(homedir)s/.netrc:%(homedir)s/.netrc:ro' % dict(
                 homedir=HOME_DIR),
             '-v', '%(homedir)s/.gitconfig:%(homedir)s/.gitconfig:ro' % dict(
                 homedir=HOME_DIR),
-            '-v', get_volume_mapping('%(homedir)s/.docker:%(homedir)s/.docker:rw' % dict(
-                homedir=HOME_DIR)),
+            '-v', get_volume_mapping('%(homedir)s/.docker/config.json:%(docker_config)s/config.json:rw' % dict(
+                homedir=HOME_DIR, docker_config=DOCKER_CONFIG)),
             '-v', '/etc/docker:/etc/docker:ro',
             '-v', '%(workdir)s:%(workdir)s:rw' % dict(workdir=WORKDIR),
             '-v', '/var/run/docker.sock:/var/run/docker.sock:rw',
@@ -345,10 +361,13 @@ class TestRunner(unittest.TestCase):
             '-e', 'SKIPPER_UID=%(user_uid)s' % dict(user_uid=USER_ID),
             '-e', 'HOME=%(homedir)s' % dict(homedir=HOME_DIR),
             '-e', 'CONTAINER_RUNTIME_COMMAND=%(runtime_command)s' % dict(runtime_command=utils.get_runtime_command()),
+            '-e', 'DOCKER_CONFIG=/opt/.docker',
+            '-e', 'DOCKER_CONTEXT=default',
             '-e', 'SKIPPER_DOCKER_GID=978',
             '-v', get_volume_mapping('%(homedir)s/.netrc:%(homedir)s/.netrc:ro' % dict(homedir=HOME_DIR)),
             '-v', get_volume_mapping('%(homedir)s/.gitconfig:%(homedir)s/.gitconfig:ro' % dict(homedir=HOME_DIR)),
-            '-v', get_volume_mapping('%(homedir)s/.docker:%(homedir)s/.docker:rw' % dict(homedir=HOME_DIR)),
+            '-v', get_volume_mapping('%(homedir)s/.docker/config.json:%(docker_config)s/config.json:rw' % dict(
+                homedir=HOME_DIR, docker_config=DOCKER_CONFIG)),
             '-v', get_volume_mapping('/etc/docker:/etc/docker:ro'),
             '-v', get_volume_mapping('%(workdir)s:%(workdir)s:rw' % dict(workdir=WORKDIR)),
             '-v', get_volume_mapping('/var/run/docker.sock:/var/run/docker.sock:rw'),
@@ -390,10 +409,13 @@ class TestRunner(unittest.TestCase):
             '-e', 'SKIPPER_UID=%(user_uid)s' % dict(user_uid=USER_ID),
             '-e', 'HOME=%(homedir)s' % dict(homedir=HOME_DIR),
             '-e', 'CONTAINER_RUNTIME_COMMAND=%(runtime_command)s' % dict(runtime_command=utils.get_runtime_command()),
+            '-e', 'DOCKER_CONFIG=/opt/.docker',
+            '-e', 'DOCKER_CONTEXT=default',
             '-e', 'SKIPPER_DOCKER_GID=978',
             '-v', get_volume_mapping('%(homedir)s/.netrc:%(homedir)s/.netrc:ro' % dict(homedir=HOME_DIR)),
             '-v', get_volume_mapping('%(homedir)s/.gitconfig:%(homedir)s/.gitconfig:ro' % dict(homedir=HOME_DIR)),
-            '-v', get_volume_mapping('%(homedir)s/.docker:%(homedir)s/.docker:rw' % dict(homedir=HOME_DIR)),
+            '-v', get_volume_mapping('%(homedir)s/.docker/config.json:%(docker_config)s/config.json:rw' % dict(
+                homedir=HOME_DIR, docker_config=DOCKER_CONFIG)),
             '-v', get_volume_mapping('/etc/docker:/etc/docker:ro'),
             '-v', get_volume_mapping('%(workdir)s:%(workdir)s:rw' % dict(workdir=WORKDIR)),
             '-v', get_volume_mapping('/var/run/docker.sock:/var/run/docker.sock:rw'),
@@ -439,10 +461,13 @@ class TestRunner(unittest.TestCase):
             '-e', 'SKIPPER_UID=%(user_uid)s' % dict(user_uid=USER_ID),
             '-e', 'HOME=%(homedir)s' % dict(homedir=HOME_DIR),
             '-e', 'CONTAINER_RUNTIME_COMMAND=%(runtime_command)s' % dict(runtime_command=utils.get_runtime_command()),
+            '-e', 'DOCKER_CONFIG=/opt/.docker',
+            '-e', 'DOCKER_CONTEXT=default',
             '-e', 'SKIPPER_DOCKER_GID=978',
             '-v', get_volume_mapping('%(homedir)s/.netrc:%(homedir)s/.netrc:ro' % dict(homedir=HOME_DIR)),
             '-v', get_volume_mapping('%(homedir)s/.gitconfig:%(homedir)s/.gitconfig:ro' % dict(homedir=HOME_DIR)),
-            '-v', get_volume_mapping('%(homedir)s/.docker:%(homedir)s/.docker:rw' % dict(homedir=HOME_DIR)),
+            '-v', get_volume_mapping('%(homedir)s/.docker/config.json:%(docker_config)s/config.json:rw' % dict(
+                homedir=HOME_DIR, docker_config=DOCKER_CONFIG)),
             '-v', get_volume_mapping('/etc/docker:/etc/docker:ro'),
             '-v', get_volume_mapping('%(workdir)s:%(workdir)s:rw' % dict(workdir=WORKDIR)),
             '-v', get_volume_mapping('/var/run/docker.sock:/var/run/docker.sock:rw'),
@@ -494,6 +519,8 @@ class TestRunner(unittest.TestCase):
             '-e', 'SKIPPER_UID=%(user_uid)s' % dict(user_uid=USER_ID),
             '-e', 'HOME=%(homedir)s' % dict(homedir=HOME_DIR),
             '-e', 'CONTAINER_RUNTIME_COMMAND=%(runtime_command)s' % dict(runtime_command=utils.get_runtime_command()),
+            '-e', 'DOCKER_CONFIG=/opt/.docker',
+            '-e', 'DOCKER_CONTEXT=default',
             '-e', 'SKIPPER_DOCKER_GID=978',
             '-v', '%(homedir)s/.netrc:%(homedir)s/.netrc:ro' % dict(homedir=HOME_DIR),
             '-v', '%(homedir)s/.gitconfig:%(homedir)s/.gitconfig:ro' % dict(homedir=HOME_DIR),
diff --git a/tests/test_runner_podman.py b/tests/test_runner_podman.py
index 06f8ad7..0105936 100644
--- a/tests/test_runner_podman.py
+++ b/tests/test_runner_podman.py
@@ -4,6 +4,7 @@ import mock
 from skipper import utils
 from skipper import runner
 from skipper.runner import get_default_net
+from skipper.utils import PODMAN, DOCKER_CONFIG
 from tests.test_runner import get_volume_mapping
 
 USER_ID = 1000
@@ -85,7 +86,8 @@ class TestRunnerPodman(unittest.TestCase):
             '--group-add', 'keep-groups',
             '-v', get_volume_mapping('%(homedir)s/.netrc:%(homedir)s/.netrc:ro' % dict(homedir=HOME_DIR)),
             '-v', get_volume_mapping('%(homedir)s/.gitconfig:%(homedir)s/.gitconfig:ro' % dict(homedir=HOME_DIR)),
-            '-v', get_volume_mapping('%(homedir)s/.docker:%(homedir)s/.docker:rw' % dict(homedir=HOME_DIR)),
+            '-v', get_volume_mapping('%(homedir)s/.docker/config.json:%(docker_config)s/config.json:rw' % dict(
+                homedir=HOME_DIR, docker_config=DOCKER_CONFIG)),
             '-v', get_volume_mapping('/etc/docker:/etc/docker:ro'),
             '-v', get_volume_mapping('%(workdir)s:%(workdir)s:rw' % dict(workdir=WORKDIR)),
             '-v', get_volume_mapping('entrypoint.sh:/opt/skipper/skipper-entrypoint.sh:rw'),
@@ -127,7 +129,8 @@ class TestRunnerPodman(unittest.TestCase):
             '--group-add', 'keep-groups',
             '-v', get_volume_mapping('%(homedir)s/.netrc:%(homedir)s/.netrc:ro' % dict(homedir=HOME_DIR)),
             '-v', get_volume_mapping('%(homedir)s/.gitconfig:%(homedir)s/.gitconfig:ro' % dict(homedir=HOME_DIR)),
-            '-v', get_volume_mapping('%(homedir)s/.docker:%(homedir)s/.docker:rw' % dict(homedir=HOME_DIR)),
+            '-v', get_volume_mapping('%(homedir)s/.docker/config.json:%(docker_config)s/config.json:rw' % dict(
+                homedir=HOME_DIR, docker_config=DOCKER_CONFIG)),
             '-v', get_volume_mapping('/etc/docker:/etc/docker:ro'),
             '-v', get_volume_mapping('%(workdir)s:%(workdir)s:rw' % dict(workdir=WORKDIR)),
             '-v', get_volume_mapping('entrypoint.sh:/opt/skipper/skipper-entrypoint.sh:rw'),
@@ -169,7 +172,8 @@ class TestRunnerPodman(unittest.TestCase):
             '--group-add', 'keep-groups',
             '-v', get_volume_mapping('%(homedir)s/.netrc:%(homedir)s/.netrc:ro' % dict(homedir=HOME_DIR)),
             '-v', get_volume_mapping('%(homedir)s/.gitconfig:%(homedir)s/.gitconfig:ro' % dict(homedir=HOME_DIR)),
-            '-v', get_volume_mapping('%(homedir)s/.docker:%(homedir)s/.docker:rw' % dict(homedir=HOME_DIR)),
+            '-v', get_volume_mapping('%(homedir)s/.docker/config.json:%(docker_config)s/config.json:rw' % dict(
+                homedir=HOME_DIR, docker_config=DOCKER_CONFIG)),
             '-v', get_volume_mapping('/etc/docker:/etc/docker:ro'),
             '-v', get_volume_mapping('%(workdir)s:%(workdir)s:rw' % dict(workdir=WORKDIR)),
             '-v', get_volume_mapping('entrypoint.sh:/opt/skipper/skipper-entrypoint.sh:rw'),
@@ -215,7 +219,8 @@ class TestRunnerPodman(unittest.TestCase):
             '--group-add', 'keep-groups',
             '-v', get_volume_mapping('%(homedir)s/.netrc:%(homedir)s/.netrc:ro' % dict(homedir=HOME_DIR)),
             '-v', get_volume_mapping('%(homedir)s/.gitconfig:%(homedir)s/.gitconfig:ro' % dict(homedir=HOME_DIR)),
-            '-v', get_volume_mapping('%(homedir)s/.docker:%(homedir)s/.docker:rw' % dict(homedir=HOME_DIR)),
+            '-v', get_volume_mapping('%(homedir)s/.docker/config.json:%(docker_config)s/config.json:rw' % dict(
+                homedir=HOME_DIR, docker_config=DOCKER_CONFIG)),
             '-v', get_volume_mapping('/etc/docker:/etc/docker:ro'),
             '-v', get_volume_mapping('%(workdir)s:%(workdir)s:rw' % dict(workdir=WORKDIR)),
             '-v', get_volume_mapping('entrypoint.sh:/opt/skipper/skipper-entrypoint.sh:rw'),
@@ -259,7 +264,8 @@ class TestRunnerPodman(unittest.TestCase):
             '--group-add', 'keep-groups',
             '-v', get_volume_mapping('%(homedir)s/.netrc:%(homedir)s/.netrc:ro' % dict(homedir=HOME_DIR)),
             '-v', get_volume_mapping('%(homedir)s/.gitconfig:%(homedir)s/.gitconfig:ro' % dict(homedir=HOME_DIR)),
-            '-v', get_volume_mapping('%(homedir)s/.docker:%(homedir)s/.docker:rw' % dict(homedir=HOME_DIR)),
+            '-v', get_volume_mapping('%(homedir)s/.docker/config.json:%(docker_config)s/config.json:rw' % dict(
+                homedir=HOME_DIR, docker_config=DOCKER_CONFIG)),
             '-v', get_volume_mapping('/etc/docker:/etc/docker:ro'),
             '-v', get_volume_mapping('%(workdir)s:%(workdir)s:rw' % dict(workdir=WORKDIR)),
             '-v', get_volume_mapping('entrypoint.sh:/opt/skipper/skipper-entrypoint.sh:rw'),