how to resolve the docker-compose up command execution - docker-compose

I am trying to test this project https://github.com/saan099/sawtooth-test
But while executing docker-compose up command I found this problem:
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 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/
I have tried to change with another version but I still have the same problem. I would be very grateful please if you could help me please.
Those are my docker version and my docker-composer version:
>>> ~/sawtooth-test $ docker --version
Docker version 1.13.1, build 092cba3
>>> ~/sawtooth-test $ docker-compose version
docker-compose version 1.8.0, build unknown
docker-py version: 1.9.0
CPython version: 2.7.12
OpenSSL version: OpenSSL 1.0.2g 1 Mar 2016
But when I put this docker-compose --version
>>> ~/sawtooth-test $ docker version
Client:
Version: 1.13.1
API version: 1.26
Go version: go1.6.2
Git commit: 092cba3
Built: Thu Nov 2 20:40:23 2017
OS/Arch: linux/amd64
>>> ~/sawtooth-test $ docker-compose --version
docker-compose version 1.8.0, build unknown
Thank you in advance.

Update the first line of your docker-compose.yml file to say version: '3' instead of version: '2.1'
Here is some more information for you pertaining to Docker-Compose versioning.
https://docs.docker.com/compose/compose-file/compose-versioning/

go and nano to docker-compose.yaml
edit version : '2' to "2"
sudo docker-compose up
finally should fix your issue

Related

Docker-Compose results in The platform targeted with the current context is not supported

I am running local testing on macOS using docker-compose and I believe I'm following the getting started documentation exactly. But I get the following error:
% docker-compose up
ERROR: The platform targeted with
the current context is not supported.
Make sure the context in use
targets a Docker Engine.
Any idea why that is happening? Docker Desktop is running.
Versions:
OSX 12.2.1
Docker Desktop 4.5.0
docker-compose version 1.29.2, build 5becea4c
docker-py version: 5.0.0
Key files:
Dockerfile:
# syntax=docker/dockerfile:1
FROM python:3.7-alpine
WORKDIR /code
ENV FLASK_APP=app.py
ENV FLASK_RUN_HOST=0.0.0.0
RUN apk add --no-cache gcc musl-dev linux-headers
COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt
EXPOSE 5000
COPY . .
CMD ["flask", "run"]
docker-compose.yml:
version: "3.9"
services:
web:
build: .
ports:
- "8000:5000"
redis:
image: "redis:alpine"
Use docker compose up instead of docker-compose up.
Also if you are deploying to ECS, the asymmetrical port mapping "8000:5000" will not work. The port mapping has to be symmetrical.
Lastly, if you are deploying to ECS, the build will not work as expected. You can read more about the supported fields here.
https://docs.docker.com/cloud/ecs-compose-features/. So you have to build the image in your local and tag it as <accontId>.dkr.ecr.us-west-2.amazonaws.com/<imageName> and push it to ecs and use the image in your docker-compose file.

Docker exits as soon as its run

I am not sure if this is the right platform but I have an issue I have been battling for sometime now and frankly its just driving me crazy and my efforts to google it have not been fruitful either. A mongodb docker exits soon as run, see screenshot:
and upon looking at the containers, i see this:
and docker logs [container] is just empty. Any assistance will be highly appreciated as am currently just don't have any other ideas on how to go about this.
cat /etc/os-release gives the following output:
AME="CentOS Stream"
VERSION="8"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="8"
PLATFORM_ID="platform:el8"
PRETTY_NAME="CentOS Stream 8"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:8"
HOME_URL="https://centos.org/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux 8"
REDHAT_SUPPORT_PRODUCT_VERSION="CentOS Stream"
And docker version gives the following:
Client: Docker Engine - Community
Version: 20.10.7
API version: 1.41
Go version: go1.13.15
Git commit: f0df350
Built: Wed Jun 2 11:56:24 2021
OS/Arch: linux/amd64
Context: default
Experimental: true
Server: Docker Engine - Community
Engine:
Version: 20.10.7
API version: 1.41 (minimum version 1.12)
Go version: go1.13.15
Git commit: b0f5bc3
Built: Wed Jun 2 11:54:48 2021
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.4.6
GitCommit: d71fcd7d8303cbf684402823e425e9dd2e99285d
runc:
Version: 1.0.0-rc95
GitCommit: b9ee9c6314599f1b4a7f497e1f1f856fe433d3b7
docker-init:
Version: 0.19.0
GitCommit: de40ad0

"docker-compose.yml" version rejected, but why?

My YML file begins like this:
version: "3.7"
services:
... ... etc ... ...
But I get this error:
ERROR: Version in "./docker-compose.yml" is unsupported. You might be seeing this [...]
However, the Docker is "Ubuntu's latest version!"
$ docker version
Client:
Version: 18.09.7
API version: 1.39
Go version: go1.10.1
Git commit: 2d0083d
Built: Fri Aug 16 14:20:06 2019
OS/Arch: linux/amd64
Experimental: false
Server:
Engine:
Version: 18.09.7
API version: 1.39 (minimum version 1.12)
Go version: go1.10.1
Git commit: 2d0083d
Built: Wed Aug 14 19:41:23 2019
OS/Arch: linux/amd64
Experimental: false
$ docker-compose version
docker-compose version 1.17.1, build unknown
docker-py version: 2.5.1
CPython version: 2.7.17
OpenSSL version: OpenSSL 1.1.1 11 Sep 2018
The documentation https://docs.docker.com/compose/compose-file/ says that version 3.7 will work with "18.06.0+" so I really don't understand why I'm getting this message at all. The documentation would suggest that this version of Docker does support (and expect) this version.
It looks like your version of docker-compose is incompatible. The version you are using (1.17.1) only supports a compose file format up to version 3.4. You can view the compatibility matrix in the release notes:
1.17.1 release
You can update docker-compose with the following:
curl -L https://github.com/docker/compose/releases/download/1.25.4/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
And find more information about docker-compose installation here

Unable to use 'NSKeyValueObservation' in Swift Docker 5.1.3

I am attempting to use NSKeyValueObservation in a Swift executable I am running on Docker. I am using the following swift version: 5.1.3
I stripped down everything and I literally just declare in main.swift:
var observer: NSKeyValueObservation?
The error returned is:
/package/Sources/TestPackage/main.swift:30:19: error: use of undeclared type 'NSKeyValueObservation'
var observer: NSKeyValueObservation?
Since the error does not occur locally, my hunch is that Docker is running linux and linux doesn't know about NSKeyValueObservation but this isn't documented anywhere. If so, how do I get around this issue?
The relevant Docker version information is:
Client: Docker Engine - Community
Version: 19.03.5
API version: 1.40
Go version: go1.12.12
Git commit: 633a0ea
Built: Wed Nov 13 07:22:34 2019
OS/Arch: darwin/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 19.03.5
API version: 1.40 (minimum version 1.12)
Go version: go1.12.12
Git commit: 633a0ea
Built: Wed Nov 13 07:29:19 2019
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: v1.2.10
GitCommit: b34a5c8af56e510852c35414db4c1f4fa6172339
runc:
Version: 1.0.0-rc8+dev
GitCommit: 3e425f80a8c931f88e6d94a8c831b9d5aa481657
docker-init:
Version: 0.18.0
GitCommit: fec3683
Your hunch is correct. NSKeyValueObservation relies on the Objective-C runtime, which does not exist on non-Darwin platforms. You will need to use an alternative, such as some flavor of Rx.

Error creating strapi project using mongodb

I installed MongoDB community edition following its doc on ubuntu. Then installed strapi following its doc. Started MongoDb in terminal from command-mongod
Getting the entry
...
[initandlisten] waiting for connections on port 27017
While creating the project with default values using strapi new myStrapiProject throws the error:
and mongod log details:
it goes till connection id: 62 I don't know why. I've tried creating the project by starting MongoDb using its start, stop command but no change. I'm completely new to MongoDb and Strapi. Any help would be appreciated. I have referred this but it didn't solve my issue.
Version details:
$ mongod --version
db version v3.6.4
$ strapi --version
3.0.0-alpha.12
$ node --version
v9.11.1
$ npm --version
5.6.0
$ git --version
git version 2.7.4
check your minimum requirements for the strapi alpha 3.0.0
From the official site:
Node.js >= 10.x
NPM >= 6.x
MongoDB >= 3.x