How to check the docker-compose file version? - docker

I would like to make sure that I'm using version 3 of the compose file format. However, on https://docs.docker.com/compose/compose-file/ I was not able to find out how to do this.
My Docker version is 17.04.0-ce, build 4845c56, and my Docker-Compose version is docker-compose version 1.9.0, build 2585387. I'm not sure since when version 3 of the compose file format was introduced, however. How can I find this out?

It's on your docker-compose.yml file. First parameter is Docker Compose version.
version: '3'
Docker Compose version file 3 was introduced in release 1.10.0 of Docker Compose and 1.13.0 release of Docker Engine.
Here you can see release notes for Docker Compose 1.10.0 which introduces version file 3: https://github.com/docker/compose/releases/tag/1.10.0

The docker compose version 3 syntax requires docker version 1.13 and docker-compose version 1.10 (see the release notes). See the release notes for the version compatibility matrix and upgrade instructions.
Note that the version 3 syntax is designed for docker swarm mode, and it was first supported with the docker stack deploy in docker release 1.13. There's not much reason to upgrade to the version 3 syntax if you are still using docker-compose itself.
See also the compose file versioning page that describes the differences between the different yml versions.

Related

How to determine highest docker-compose file version for the installed docker-compose

I have docker-compose 1.25.4 on a system, and docker 19.03. How do I know which version of Compose file format it supports, without trying a bunch or searching through release notes etc?
I determined by trial and error that the highest Compose file format version that docker-compose 1.25.4 supports is 3.7. Therefore, my docker-compose.yml requires version: "3.7".
But what if I need to determine this programmatically? Or reliably, without trial and error, and without looking at release notes?
The docs at https://docs.docker.com/compose/compose-file/compose-versioning/ suggest that highest version should be 3.8 but this does not work. Indeed the release notes indicate that 3.8 became supported as of docker-compose 1.25.5.
I looked through various docker-compose commands and could not spot anything that would say "This version of docker-compose supports Compose file version up to x.y".
I figured out that there is no way to find this out via the cli.
You need to check the docker-compose github releases for this.
For example on Ubuntu: v1.25.0 version of docker-compose which is currently the latest and gets to be installed by default, but it is compatible with the 3.7 at highest.
https://github.com/docker/compose/releases/tag/1.25.0
The Compose file format compatibility matrix part is the interesting here.

Which docker versions are supported on kubernetes 1.18 and 1.19?

I found the following description about supported docker versions in kubernetes v1.18 and 1.19 documents.
Container runtimes
The Kubernetes release notes list which versions of Docker are compatible with that version of Kubernetes.
But I cannot find supported docker versions in the Relase Notes.
v1.18 Release Notes
v1.19 Release Notes
Also, I check the other k8s documents.
v1.15 and v1.16 document describe supported docker versions.
The documents specifically list them.
v1.15 Release Notes
v1.16 Release Notes
The list of validated docker versions remains unchanged.
The current list is 1.13.1, 17.03, 17.06, 17.09, 18.06, 18.09. (#72823, #72831)
In fact, there is no information about docker version for 1.18 and 1.19 kubernetes version.
You can suggest documentation upgrade using this link for kubernetes team to include theses information.
As per https://kops.sigs.k8s.io/releases/1.19-notes/ the Docker 19.03.11 for Kubernetes 1.18+ will be supported.
Docker 19.03.11 for Kubernetes 1.18+
The change logs for all of the Kubernetes versions, and information on supported versions of Docker, are also specified on the following webpage,
https://github.com/kubernetes/kubernetes/tree/master/CHANGELOG

Docker compose version unsupported

I was using version: '3' for the docker-compose, works fine in my host machine (macOS), but when I tried to build the images and run the containers in the server, I got the response
Version in "./docker-compose.dev.yml" is unsupported. You might be seeing this error because you're using the wrong Compose file version. Either specify a version of "2" (or "2.0") and place your service definitions under the services key, or omit the version key and place your service definitions at the root of the file to use version 1.
For more on the Compose file format versions, see https://docs.docker.com/compose/compose-file/
OS Ubuntu "16.04.6 LTS (Xenial Xerus)" in AWS (ec2)
Docker version 19.03.8
docker-compose version 1.8.0, build unknown
I found a way around and it is to use version 2, How can I solve this?

Why do we increment the version in Docker Compose? (Version 1, 2, and 3)

Currently learning about Docker and I was wondering why we increment the version in Docker-Compose.
There are Three docker versions: 1, 2, and 3. Why do we have only 3 versions? ... Does version 3 give you more options?
Is it necessary to upgrade the Docker Compose version?
You are referring to the version of the file format of docker-compose.It has changed through time to add more options, but when doing so they also changed the way some of the functionality was declared, when that happens they change the major version.
The older versions are maintained o that backwards-compatibility to docker-compose files people were already using keep working with newer versions of docker and docker-compose.
If you are starting to learn, or starting a new project, the best practice is to use the latest version available.
In the documentation page you have more information about the file format of docker-compose and what's available in each version (3.7 as the writing of this comment).
Those are not versions of the docker itself. Those are versions of the configuration file format.
Each version defines which options you can use in the docker-compose.yml file. For example, see this: https://docs.docker.com/compose/compose-file/compose-versioning/

Upgrade Gitlab from source 7.4 to Docker 10.4

I've been looking around for people trying to do such madness but can't find anything.
What I'm trying to do is upgrade from an old, unmaintained version of Gitlab 7.4.2 that was running on a server to a Docker version on 10.4.
I did my backup correctly with 7.4 but obviously as I'm trying to unpack it, I get the following :
Your current GitLab version (10.4.2) differs from the GitLab version in the backup!
Please switch to the following version and try again:
version: 7.4.2
I'm not sure of the procedure I should do next but have a few ideas I'd like to run by you here to see which is the easiest/most doable.
Upgrade my bare-metal server gradually from 7.4 to 8.x, then to 9.x to have the minimum Docker version present on Docker Hub. Then do a backup and repeat the process on Docker.
Force (how?) the Docker version to take this backup anyway
An other solution maybe ?
Thanks in advance for any help.
Madness indeed....
The brute force take of upgrading here is probably the way to go, as this is by far the safest one.
The only alternative I can offer is to migrate your source instance to the omni-bus installation of the same version an then let the package manager deal with the mess and update to the latest version.
But you should prepared for problems. Non omni-bus to omni-bus installations are not tested. If you want to try it anyway, here is the upgrade guide for the omni-bus versions.
If you have then the newest version you can simply export and import it into the docker instance as the docker image simply contains a omni-bus instance.
You can not upgrade Gitlab directly and must upgrade it step by step to the next major release: 7 -> 8 -> 9 -> 10.
You can see more information in the link below:
[https://docs.gitlab.com/ee/policy/maintenance.html#upgrade-recommendations][1]
and execute the following commands:
sudo docker stop gitLab
sudo docker rm gitLab
You can see more information in the link below:
[https://docs.gitlab.com/omnibus/docker/README.html#upgrade-gitlab-to-newer-version][1]
and after executing 2 above commands you can change the GitLab version that existing in the content of the docker-compose.yml .
examlpe:
gitlab:
restart: always
image: sameersbn/gitlab:11.11.0
depends_on:
- redis
- postgresql
to chenged:
gitlab:
restart: always
image: sameersbn/gitlab:12.7.6
depends_on:
- redis
- postgresql
and execute the following command:
sudo docker-compose up -d
Repeat these stages and Step by step between the GitLab versions to get the desired version.

Resources