run docker command within python subprocess within GitHub runner

I am running functional tests as CI in my GitHub runner.
To properly execute my tests, I am building a docker image and running it (a slightly modified mysql container). Because I am building the container from a Dockerfile (not only pulling it from a registry), I dont use GitHub service or container capabilities (https://docs.github.com/en/actions/use-cases-and-examples/using-containerized-services/about-service-containers).

Instead I have some steps dedicated in my GH workflow to build the container and run it like this

  - name: build docker container
    run: |
      cd tests/functional/olbp/mocked_data/
      docker build --no-cache -f my_service.Dockerfile -t my_service_test:latest .
  - name: run container
    run: docker run --name my_service -d -p 127.0.0.1:3306:3306 my_service_test --sql_mode="NO_ENGINE_SUBSTITUTION"
  - name: wait for MySQL to start
    run: |
      until mysqladmin ping -h 127.0.0.1 --silent; do
      echo 'Waiting for MySQL to start...'
      sleep 1
      done

Finally I am calling my functional tests (pytest) with python

  - name: run the functional tests
    run: python -m pytest tests/functional -vv -s --log-cli-level=DEBUG

This is working fine, my tests can obvisouly interract with the mysql container.

However I am struggling to interract with Docker in this context. I would like to generate a mysqldump part of my tests. So I wrote this inside my tests:

dck_exc_output = subprocess.run(
    [
        "docker",
        "exec",
        "my_service",
        "mysqldump",
        "--skip-triggers",
        "--skip-extended-insert",
        "--compact",
        "--no-create-info",
        "-uroot",
        "-psupersecret",
        "my_db",
        "my_table",
        ">",
        live_data_dump,
    ],
    capture_output=True,
    shell=True,
)

logging.debug(dck_exc_output)

It is working fine when being executed from my computer but whenever I try to get this executed inside the GH Runner (this docker command or even a simple docker version). I end up on this output:

DEBUG    root:my_test.py:246 CompletedProcess(args=['docker', 'version'], returncode=0, stdout=b'', stderr=b'nUsage:  docker [OPTIONS] COMMANDnnA self-sufficient runtime for containersnnCommon Commands:n  run         Create and run a new container from an imagen  exec        Execute a command in a running containern  ps          List containersn  build       Build an image from a Dockerfilen  pull        Download an image from a registryn  push        Upload an image to a registryn  images      List imagesn  login       Log in to a registryn  logout      Log out from a registryn  search      Search Docker Hub for imagesn  version     Show the Docker version informationn  info        Display system-wide informationnnManagement Commands:n  builder     Manage buildsn  buildx*     Docker Buildxn  compose*    Docker Composen  container   Manage containersn  context     Manage contextsn  image       Manage imagesn  manifest    Manage Docker image manifests and manifest listsn  network     Manage networksn  plugin      Manage pluginsn  system      Manage Dockern  trust       Manage trust on Docker imagesn  volume      Manage volumesnnSwarm Commands:n  swarm       Manage SwarmnnCommands:n  attach      Attach local standard input, output, and error streams to a running containern  commit      Create a new image from a container's changesn  cp          Copy files/folders between a container and the local filesystemn  create      Create a new containern  diff        Inspect changes to files or directories on a container's filesystemn  events      Get real time events from the servern  export      Export a container's filesystem as a tar archiven  history     Show the history of an imagen  import      Import the contents from a tarball to create a filesystem imagen  inspect     Return low-level information on Docker objectsn  kill        Kill one or more running containersn  load        Load an image from a tar archive or STDINn  logs        Fetch the logs of a containern  pause       Pause all processes within one or more containersn  port        List port mappings or a specific mapping for the containern  rename      Rename a containern  restart     Restart one or more containersn  rm          Remove one or more containersn  rmi         Remove one or more imagesn  save        Save one or more images to a tar archive (streamed to STDOUT by default)n  start       Start one or more stopped containersn  stats       Display a live stream of container(s) resource usage statisticsn  stop        Stop one or more running containersn  tag         Create a tag TARGET_IMAGE that refers to SOURCE_IMAGEn  top         Display the running processes of a containern  unpause     Unpause all processes within one or more containersn  update      Update configuration of one or more containersn  wait        Block until one or more containers stop, then print their exit codesnnGlobal Options:n      --config string      Location of client config files (defaultn                           "/home/runner/.docker")n  -c, --context string     Name of the context to use to connect to then                           daemon (overrides DOCKER_HOST env var andn                           default context set with "docker context use")n  -D, --debug              Enable debug moden  -H, --host list          Daemon socket to connect ton  -l, --log-level string   Set the logging level ("debug", "info",n                           "warn", "error", "fatal") (default "info")n      --tls                Use TLS; implied by --tlsverifyn      --tlscacert string   Trust certs signed only by this CA (defaultn                           "/home/runner/.docker/ca.pem")n      --tlscert string     Path to TLS certificate file (defaultn                           "/home/runner/.docker/cert.pem")n      --tlskey string      Path to TLS key file (defaultn                           "/home/runner/.docker/key.pem")n      --tlsverify          Use TLS and verify the remoten  -v, --version            Print version information and quitnnRun 'docker COMMAND --help' for more information on a command.nnFor more help on how to use Docker, head to https://docs.docker.com/go/guides/n')

I already confirmed that I have same user, same permission and same env variable between the subprocess and the GH runner commands.
I cannot understand why I am receiving this output. The docker executable seems to be found (because I am receiving the helppage as if I was executing a wrong command) but it will not execute as it is doing when I run the test locally.

1

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật