Run build step within MySql docker container

Answered

Hi, I hope someone can help me with this problem I'm having.

I'm trying to run integration tests for my project using a fresh MySql database image and spinning up a container with it using the Docker Wrapper extension (Docker Settings -> Run step within Docker container).

The build runs, pulls the image and tries to run the tests but they fail with the following error:

MySql.Data.MySqlClient.MySqlException : Unable to connect to any of the specified MySQL hosts.

I've verified the image configuration locally and ran the tests without any problem on my dev PC, but when they get executed in TeamCity it doesn't work.

 

Any ideas what could be wrong with my approach?

I can provide more information if needed.

 

Thanks.

Gonzalo

0
2 comments
Avatar
Fedor Rumyantsev

Hello Gonzalo,

Could you please confirm how exactly is the container started on your machine? (e.g. exact docker run statement)
What is the connection string used for the tests? 

If you could also provide extracts from the build log related to the container start/test failure, this would be great.

0
Avatar
Permanently deleted user

Hi Fedor, thanks for getting back to me and sorry for this late response! I ended up taking a different path and using Docker Compose.

Thanks,

Gonzalo

0

Please sign in to leave a comment.