Coder Social home page Coder Social logo

docker-composer-multiple-projects-sample's Introduction

複数案件をまたいで開発しているとき、ホスト側port番号を考えるのに疲れたあなたへのサンプル

/etc/hosts

...
127.0.0.1 anken-1
127.0.0.2 anken-2
...

up and run

$ cd ./anken-1
$ docker-compose up -d

$ cd ../anken-2
$ docker-compose up -d

docker ps
docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                                 NAMES
36d5b663edf6        mysql:5.7           "docker-entrypoint.s…"   3 seconds ago       Up 2 seconds        127.0.0.2:3306->3306/tcp, 33060/tcp   anken-2_db_1
c347fe183ad6        httpd:2.4           "httpd-foreground"       3 seconds ago       Up 2 seconds        127.0.0.2:80->80/tcp                  anken-2_web_1
8ad0a5ae018d        mysql:5.7           "docker-entrypoint.s…"   3 seconds ago       Up 2 seconds        33060/tcp, 127.0.0.2:3307->3306/tcp   anken-2_secure-db_1
6955a89c43d9        httpd:2.4           "httpd-foreground"       29 seconds ago      Up 28 seconds       127.0.0.1:80->80/tcp                  anken-1_web_1
f13161e0dfef        mysql:5.7           "docker-entrypoint.s…"   29 seconds ago      Up 28 seconds       33060/tcp, 127.0.0.1:3307->3306/tcp   anken-1_secure-db_1
c1905356e589        mysql:5.7           "docker-entrypoint.s…"   29 seconds ago      Up 28 seconds       127.0.0.1:3306->3306/tcp, 33060/tcp   anken-1_db_1

IP addresses style

$ curl 127.0.0.1:80
<html>案件1</html>

$ curl 127.0.0.2:80
<html>案件2</html>

curl 127.0.0.2:3306
Warning: Binary output can mess up your terminal. Use "--output -" to tell 
Warning: curl to output it to your terminal anyway, or consider "--output 
Warning: <FILE>" to save to a file.

hostname style

$ curl anken-1:80
<html>案件1</html>

$ curl anken-2:80
<html>案件2</html>

🎉

docker-composer-multiple-projects-sample's People

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

tachibana224898

docker-composer-multiple-projects-sample's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.