How to setup docker architecture

I’d like to have the following configuration:

               Docker Containers   

||||||||||||      ||||||||||||      ||||||||||||
|          |      |          |      |          |
|          |      |          |      |          |
|          | <--> |          | <--> |          |
|          |      |          |      |          |
|          |      |          |      |          |
||||||||||||      ||||||||||||      ||||||||||||
   nginx           web server         postgres

With the following setup:

  • can we update docker default configure?
  • Run DDL-script generated by Entity Framework does not create tables in Docker container
  • Docker Run With SELinux on ubuntu Constrain violation
  • Can I use docker to isolate my development environment?
  • How to Set Capabilities on Node Browser with selenium Docker
  • Minimize CentOS-based Docker image
    1. Nginx

      • change nginx.conf
      • add an appropriate sites-available entry
      • link config sites-enabled
    2. PostgreSQL

      • setup user login and password
    3. Web Server

      • clone from repository
      • build release version
      • run server process

    I have a couple of questions as well:

    a) how to pass secrets to Docker like API keys, passwords and so on?

    b) is this possible to clone repo from docker or there is other way to do that?

    c) how and where deploy such applications?

    d) is that setup even possible?

  • Accessing a Docker MySQL server from the host machine, without needing the container's IP address
  • mount a folder in docker machine using docker for mac
  • Cannot access tomcat8 server running in docker container from host machine
  • DC/OS packages not exist
  • Run jhipster-registry in production
  • Amazon EC2 boot time
  • 3 Solutions collect form web for “How to setup docker architecture”

    This setup is very common with docker. I’d recommend you look into using docker-compose (example) because it makes setting it up drastically easier.

    Passing in secrets is done through environment variables at docker run time. If you have many you can store them in an env-file.

    Yes, you can clone a repo from a docker container or during a docker build. Cloning a private repo during a docker build is currently not feasible (without exposing your credentials) so it’s usually recommended to clone your repo before running docker build.

    a) usually pass secrets through environment variables, this is easy for containers to use.

    b) yes, you can, if you want clone a public repo, you can do it in Dockerfile with RUN git clone repo; also you can pull you repo at Entrypoint if you want make sure your repo is updated.

    c) emm…I don’t know how to answer this, maybe docker docs?

    d) this setup is possible, but here is some advices:

    • you can try using nginx-proxy which is easier to make reserve proxy to your web server container.
    • using Volume to serve your web contents, so you can bind volume to nginx container and serve your static contents with nginx.
    • build a data only container for your database, you can check this post

    This is piece of cake with Docker and Docker-Compose. All you need are suitable containers where you can pass the parameters on startup. Afterwards the compose-template can be moved around and instanced multiple times.

    The containers communicate through links and docker provides hostnames for handling changing ip addresses.

    This is an example for setting up the Jira web application with a postgres database. This should be analogous to your example. An nginx server can be added as easily.

      image: blacklabelops/jira
        - '8100:8080'
        - /opt/atlassian-home
        - 'DATABASE_URL=postgresql://jiradb@postgresql/jiradb'
        - 'DB_PASSWORD=jellyfish'
        - postgresql
      image: sameersbn/postgresql:9.4-1
        - '5432:5432'
        - 'PSQL_TRUST_LOCALNET=true'
        - 'DB_USER=jiradb'
        - 'DB_PASS=jellyfish'
        - 'DB_NAME=jiradb'

    The Jira server will be available with localhost:8100 and the database will be available with localhost:5432

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.