Welcome to the Linux Foundation Forum!

Docker compose file

Hi There,

I get this error when I run Docker compose file:

root@ubuntu-s-1vcpu-1gb-nyc3-01:~/wordpress# docker-compose --tlsverify --tlscacert /root/.docker/machine/machines/dockerhost/ca.pem --tlscert=/root/.docker/machine/machines/dockerhost/cert.pem --tlskey=/root/.docker/machine/machines/dockerhost/key.pem -H tcp://159.203.65.196:2376 up -d

ERROR: Version in "./docker-compose.yaml" is unsupported. You might be seeing this error because you're using the wrong Compose file version. Either specify a supported version ("2.0", "2.1", "3.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/

Which version should I use in Docker compose file if my docker version is 20.10.8
according to the table at https://docs.docker.com/compose/compose-file/ the last docker version is 19.03.0+ (compose file format is 3.8)

When I using 3.8 , I still get the same error above.

Note: I used the same Docker compose file from the course.

version: "3.8"

services:
db:
image: mysql:5.7
volumes:
- db_data:/var/lib/mysql
restart: always
environment:

.
.
.
.
.

root@ubuntu-s-1vcpu-1gb-nyc3-01:~/wordpress# docker version Client: Docker Engine - Community
Version: 20.10.8 < --------------
API version: 1.41
Go version: go1.16.6
Git commit: 3967b7d
Built: Fri Jul 30 19:54:27 2021
OS/Arch: linux/amd64
Context: default
Experimental: true

Server: Docker Engine - Community
Engine:
Version: 20.10.8
API version: 1.41 (minimum version 1.12)
Go version: go1.16.6
Git commit: 75249d8
Built: Fri Jul 30 19:52:33 2021
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.4.9
GitCommit: e25210fe30a0a703442421b0f60afac609f950a3
runc:
Version: 1.0.1
GitCommit: v1.0.1-0-g4144b63
docker-init:
Version: 0.19.0
GitCommit: de40ad0

Thanks,
Guy

Comments

Categories

Upcoming Training