Need advise on deployment

I m very new to docker.

So far I built two images. A database image and a web server with an app deployed on it.

I am reading different terms and concepts and super confused on how should i deliver this to my consumers as a solution. The terms like compose, swarm, docker-machine to create vm etc. are understood individually.

My trouble is I do not know what should be the right strategy to deliver my two image solution to consumer which makes it easiest to use for them. Please advise.

if you want to deliver to clients you can include your two build directories with your dockerfiles and a compose which builds and links them.

Swarm and docker-machine are not for remote deployments and handling many nodes.

it’s all about what you want to achieve…

1 Like

If you’re comfortable with everything essentially being public, one approach:

  1. Use a standard database image from Docker Hub; don’t roll your own.
  2. Build a standalone Docker image with whatever language runtime you need and your application baked into it. Publish it to Docker Hub.
  3. Create a small GitHub repository containing a README.md file and a docker-compose.yml file that references the two images above.

Then users will need to clone the GitHub repository, or at least download the docker-compose.yml file, but then will be able to just run docker-compose up to get the two-container application running.

As the application author, you shouldn’t care whether the application is running on native Docker on Linux, or a Docker Machine VM, or a Docker Machine remotely managed system, or a Docker Swarm cluster, or a Kubernetes cluster, or a Nomad cluster (the last couple of options aren’t really directly compatible with Docker Compose though).

1 Like

If using Docker >=1.13.0 as well, you can deploy Compose >=3.0 files natively with docker stack deploy -c docker-compose.yml stack.

That’d be my suggestion: Get clients on an installation of Docker compatible with that, give them the Compose file, and have them create a docker stack from it.

1 Like

tell me more on how do i do that please

https://docs.docker.com/engine/reference/commandline/stack/ and https://docs.docker.com/compose/compose-file/ should tell you most of what you need to know. The documentation is still catching up a bit

1 Like

In short:

  1. Write a docker-compose.yml to describe your services, networks, and volumes
  2. docker stack deploy -c docker-compose.yml <stackname>
  3. This will go off and create a docker stack which contains services you can see with docker service ls
1 Like

I have question here. a docker compose up do the same thing. I mean can bring up all the services volumes etc. then how it is different from docker stack ? sorry allow my dumb questions

docker-compose (https://github.com/docker/compose) is a Python program which existed before any support for “Compose files” (stacks) was merged into the Docker Engine (which is very recent, Compose has been around for years). docker stack deploy is very recent “swarm mode” functionality that uses the same file format (Compose >=3.0) but is natively supported in the Docker client and daemon (written in Go).

So, it’s somewhat the case that something which evolved in an external program layered on top of Docker has started to become officially integrated into Docker itself.

2 Likes

so the conclusion is if i am entering into the docker World with all new development then i should happily stay with docker stack deploy ?

so the conclusion is if i am entering into the docker World with all new development then i should happily stay with docker stack deploy ?

I’d suggest so. Although quite new, it’s a good bet for the future.