Docker Community Forums

Share and learn in the Docker community.

Linking two simple containers


(Lmartins) #1

Hi everyone,

Im really new to docker and have been trying to use Kitematic as a jumpstart into it.
I have two containers called wordpress and wordpressdb, which I cannot find a way to link. I believe Kitematic doesnt handle this for me at the moment, so my questions is what would be the proper command to have them linked so I can successfully start the wordpress container.

Thanks.


(Ducatel David) #2

Hi lmartins,

you have two solutions for this:

  • Use --link arguments from the docker run command

    docker run --link wordpressdb:wordpressdb_alias -d -P wordpress

  • Use the the links directive of docker-compose.yml

Link to the documentation: https://docs.docker.com/userguide/dockerlinks/


(Lmartins) #3

Thanks David,

I ended up using Docker-compose which solved this for me.

Thanks :smile: