How can I structure my docker projects for easy deployment?

时光怂恿深爱的人放手 提交于 2019-12-01 08:14:31

I have two parts: source code and config files (docker files, docker-compose files...)

I put Dockerfile and docker-compose in a folder with the struct like you and push it to a git repository. For source code (and other data), I have to manage it by hand, with separated git repositories for source code to push and pull each time it needs to update.

Be careful with the production server, just update small part instead of the whole server.

Check out the new (still experimental) docker-app (June 2018)

It will allow you to push your docker-compose to DockerHub, as well as launch your app (through docker-compose) with settings variations between dev and prod.

See example:

You can create an Application Package based on this Compose file:

$ docker-app init --single-file hello
$ ls
docker-compose.yml
hello.dockerapp

The new new file hello.dockerapp contains three YAML documents:

  • metadatas
  • the Compose file
  • settings for your application

See "Sharing your application on the Hub"

You can push any application to the Hub using docker-app push:

$ docker-app push --namespace myHubUser --tag latest

This command will create an image named myHubUser/hello.dockerapp:latest on your local Docker daemon, and push it to the Hub.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!