Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Copilot Lvl 2
Message 1 of 2

Any ways to pass arguments to service containers

Hi, I'm a really big fan of github actions, but recently I encountered some problems on running mariadb container on github hosted runner ubuntu-latest. I tried so many ways to connect my testing environment with the mariadb container - either inside another container or on the runner - but I continuously get unexpected connection drop:

ERROR 2013 (HY000)Lost connection to MySQL server at 'reading initial communication packet', system error0

 

I'm almost sure this is because mariadb image's default my.cnf has bind-address = 127.0.0.1 and because I'm trying to connect with another internal IP (172.X.X.X - like IPs) it is refusing my packet. So I wonder if there's any way to pass arguments AFTER the docker create command?

 

For a detailed example, my test.yml has a service like this:

services:
  mariadb:
    image: mariadb:10.4
    env:
      MYSQL_RANDOM_ROOT_PASSWORD: yes
      MYSQL_USER: tester
      MYSQL_PASSWORD: password
      MYSQL_DATABASE: testdb
    ports:
      - 3306/tcp
    options: --health-cmd "mysqladmin ping" --health-interval 10s --health-timeout 5s --health-retries 5

 

...and this generates a docker container with this command:

docker create --name 956473599afd483ebd7d963b64a350f2_mariadb104_c709f2 --label 10865d --network github_network_0cdba3d20e4b40e3bd417e9b6fa14f2c --network-alias mariadb -p 3306/tcp --health-cmd "mysqladmin ping" --health-interval 10s --health-timeout 5s --health-retries 5 -e "MYSQL_RANDOM_ROOT_PASSWORD=yes" -e "MYSQL_USER=tester" -e "MYSQL_PASSWORD=password" -e "MYSQL_DATABASE=testdb" -e GITHUB_ACTIONS=true mariadb:10.4

 

and I want to put some arguments after the image name:`... mariadb:10.4 [...args].

1 Reply
GitHub Staff
Message 2 of 2

Re: Any ways to pass arguments to service containers

Coud you post a more complete example of what you are trying to do?  

 

Maybe if you add MYSQL_HOST: localhost to your environment variables?