Skip to content

Instantly share code, notes, and snippets.

@mjrulesamrat
Last active December 7, 2019 05:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mjrulesamrat/84c3dfac61d58d6c3559dca2332cba17 to your computer and use it in GitHub Desktop.
Save mjrulesamrat/84c3dfac61d58d6c3559dca2332cba17 to your computer and use it in GitHub Desktop.
Docker Commands

Docker Networking

  • Use the docker network to create the frontend network:

docker network create frontend

  • User the docker network command to create the localhost network:

docker network create localhost --internal

  • Create a MySQL container that is attached to the localhost network:

docker container run -d --name database --network localhost -e MYSQL_ROOT_PASSWORD=P4ssW0rd0! mysql:5.7

  • Create an Nginx container that is attached to the localhost network:

docker container run -d --name frontend-app --network frontend nginx:latest

  • Connect frontend-app to the localhost network:

docker network connect localhost frontend-app

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment