DEV Community

loading...

Create middleware environment on Docker Compose

deadcheat profile image deadcheat ・1 min read

Things what to do in this post

  • Use Docker Compose
  • Create an environment using these middleware
    • MySQL(for database)
    • Couchbase(for datacache)

Docker Compose

is a Command-Line-Tool to manage multiple docker containers.
This is useful for creating development environment because

  • Using configuration file "docker-compose.yml", you can distribute your environment configuration to other developer easily.

How to create it

  1. Ofcourse, you'd better install docker, or you can't do this anymore.
  2. Make your dir with suitable name for your application.
  3. Create "docker-compose.yml" to your dir, edit like below
version: '3'

services:
  couch:
    container_name: "couch"
    image: deadcheat/couchbase
    deploy:
      replicas: 1
    environment:
      BUCKET_NAME: "default"
    ports:
      - 8091:8091
  db:
    image: mysql:5.7
    environment:
      - MYSQL_ROOT_PASSWORD=password
      - MYSQL_DATABASE=sample
      - MYSQL_USER=sample
      - MYSQL_PASSWORD=password
    ports:
      - 3306:3306

Then, run docker-compose up -d on your terminal.
MySQL and Couchbase environment will start up soon.

Confirm to connection,
couchbase: open http://localhost:8091/
mysql: connect to localhost:3306

To be continued...

Discussion (0)

pic
Editor guide