Hi how would I connect a mysql container to another container so that my application in one of those container can use Mysql? Based on this reference I need to run this
docker run --name some-app --link some-mysql:mysql -d application-that-uses-mysql
But I have no idea what does some-app mean and the application-that-uses-mysql? does it mean the container ID that will use it? below is the list of the running container
--name some-app
refers to the container name you want to assign to the container you are running.
application-that-uses-mysql
refers to the image which you are using. This image requires mysql
and you have connecte myqsl to this image by using the command --link some-mysql:mysql
.
However, Links are deprecated but you still can connect to other containers using networks. An answer here should be able to help you out in setting the connections.
Edit: Removed duplicate and provided complete answer.
--name some-app
gives the newly started container the name some-app
.
--link some-mysql:mysql
links the container with name some-mysql
(this is the one running MySQL) to the new container so that it can be accessed as mysql
within the container.
application-that-uses-mysql
is the name of the image containing your app.
If you are unsure about the meaning of some parameters, there is always the documentation.