Related, but not duplicated: Docker - docker-compose 'version' doesn't have any configuration options
I am currently using a v2 docker-compose.yml with the following circle.yml:
machine:
services:
- docker
test:
post:
- docker build --rm=false -t zurfyx/repo:$CIRCLE_SHA1 .
- docker-compose run web npm test
deployment:
hub:
branch: master
commands:
- docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS
- docker push zurfyx/repo:$CIRCLE_SHA1
CircleCI gives the following output:
docker-compose run web npm test
ERROR: In file './docker-compose.yml' service 'version' doesn't have any configuration options. All top level keys in your docker-compose.yml must map to a dictionary of configuration options.
docker-compose run web npm test returned exit code 1
I tried the following solutions that show up on a very recent CircleCI forum post, but I didn't manage to get rid of the problem.
Upgrading both docker and docker-compose to the latest version is required:
machine:
pre:
- curl -sSL https://s3.amazonaws.com/circle-downloads/install-circleci-docker.sh | bash -s -- 1.10.0
- pip install --upgrade pip
- pip install docker-compose
services:
- docker
Why both?
Some say that upgrading docker-compose to the latest version by using pip is enough, but apparently is not (because the current Docker Engine CircleCI version does not support it, at least not anymore):
ERROR: The Docker Engine version is less than the minimum required by
Compose. Your current project requires a Docker Engine of version
1.10.0 or greater.
If you just upgrade Docker engine, it does not make any difference, since a higher docker-compose version is required to parse v2 YAML documents.
Related
Is it possible to run docker-compose commands from with a Docker container? As an example, I am trying to install https://datahubproject.io/docs/quickstart/ FROM within a Docker container that is built using the Dockerfile shown below. The Dockerfile creates a Linux container with the prerequisites the datahubproject.io project needs (Python) and clones the repository code to a Docker container. I then want to be able to execute the Docker compose scripts from the repository code (that is cloned to the newly built Docker container) to create the Docker containers needed to run the datahubproject.io project. This is not a docker commit question.
To try this, I have the following docker-compose.yml script:
version: '3.9'
# This is the docker configuration script
services:
datahub:
# run the commands in the Dockerfile (found in this directory)
build: .
# we need tty set to true to keep the container running after the build
tty: true
...and a Dockerfile (to setup a Linux environment with the requirements needed for datahubproject.io quickstart):
FROM debian:bullseye
ENV DEBIAN_FRONTEND noninteractive
# install some of the basics our environment will need
RUN apt-get update && apt-get install -y \
git \
docker \
pip \
python3-venv
# clone the GitHub code
RUN git clone https://github.com/kuhlaid/datahub.git --branch master --single-branch
RUN python3 -m venv venv
# # the `source` command needs the bash shell
SHELL ["/bin/bash", "-c"]
RUN source venv/bin/activate
RUN python3 -m pip install --upgrade pip wheel setuptools
RUN python3 -m pip install --upgrade acryl-datahub
CMD ["datahub version"]
CMD ["./datahub/docker/quickstart.sh"]
I run docker compose up from a command line where these two scripts are located to run the Dockerfile and create the start container that will be used to install the datahubproject.io project.
I receive this error:
datahub-datahub-1 | Quickstarting DataHub: version head
datahub-datahub-1 | Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
datahub-datahub-1 | No Datahub Neo4j volume found, starting with elasticsearch as graph service
datahub-datahub-1 | ERROR: Couldn't connect to Docker daemon at http+docker://localhost - is it running?
I do not know if what I am trying to do is even possible with Docker. Any suggestions to make this work? - thank you
Can docker-compose commands by executed from within a Docker container?
Yes. A command like any other.
Is it possible to run docker-compose commands from with a Docker container?
Yes.
Any suggestions to make this work?
Like with docker on the host. Either run docker daemon or connect to one with DOCKER_HOST. DIND is relevant https://hub.docker.com/_/docker .
The answer seems to be to modify the docker-compose.yml script to contain two additional settings:
version: '3.9'
# This is the docker configuration script
services:
datahub:
# run the commands in the Dockerfile (found in this directory)
build: .
# we need tty set to true to keep the container running after the build
tty: true
# ---------- adding the following two settings seems to fixes the issue of the `CMD ["./datahub/docker/quickstart.sh"]` failing in the Dockerfile
stdin_open: true
volumes:
- /var/run/docker.sock:/var/run/docker.sock
I want to use GitLab CI/CD to automatically build android packages using Kivy's buildozer within the Python 3.9 docker image.
How can I achieve this?
Thanks in advance for your help!
I have now discovered that also a docker image exists for buildozer!
Here are the steps that worked for me under Windows 10 inspired by this answer:
Installation steps
Clone repo:
$ git clone https://github.com/kivy/buildozer
Go to folder:
$ cd buildozer
Remove entrypoint line ENTRYPOINT ["buildozer"] from Dockerfile and build docker image (the entry point prevents gitlabs runner to open a shell via sh):
$ docker build --tag=buildozer .
Go to project folder with kivy(md) app code and run:
$ docker run --volume ${pwd}:/home/user/hostcwd buildozer buildozer init
Edit buildozer.spec file:
android.accept_sdk_license = True and add python package requirements as well as pillow.
Build first apk file and install all requirements within container
(if you have trouble running this command and tried several other approaches before,
make sure to delete the .buildozer and bin folders before):
$ docker run --volume ${pwd}:/home/user/hostcwd buildozer buildozer android debug
Check the containers:
$ docker ps -a
Commit the container where the successful build happened in order
to save the added installation files for later builds:
$ docker commit sharp_nightingale registry.gitlab.com/my_user/my_repo:latest
Login to registry:
$ docker login registry.gitlab.com
Push container to registry:
$ docker push registry.gitlab.com/my_user/my_repo
Usage of container from registry
image: $CI_REGISTRY_IMAGE:latest
run-buildozer:
script:
- buildozer android debug
only:
- main
It took me a while so it hopefully helps someone else!
I have a gitlab CI file that is building projects like this:
image: 'docker/compose:1.25.1-rc1'
services:
- 'docker:dind'
variables:
GIT_SUBMODULE_STRATEGY: recursive
stages:
- build
- deploy
buildCode:
stage: build
except:
- deploy
script:
- docker build -t dataserver -t ${CI_REGISTRY}/${CI_PROJECT_PATH}:latest -f dockerfile .
deployCode:
stage: deploy
only:
- deploy
script:
- docker build -t dataserver -t ${CI_REGISTRY}/${CI_PROJECT_PATH}:latest -f dockerfile .
- docker login registry.gitlab.com -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD}
- docker push ${CI_REGISTRY}/${CI_PROJECT_PATH}:latest
- docker network create network && echo 'creating network'
- docker-compose -f docker-compose.yml pull
- docker-compose -f docker-compose.yml rm -f -s
- docker-compose -f docker-compose.yml up -d
The idea is to use docker/compose:1.25.1-rc1 to bring a docker-compose environment and build the files.
The docker file itself is calling for this image to build
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 as build
and then uses this image for runtime:
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 as final
so .net 3.1 should be installed.
however, when I run the app, I get this:
(I can't do a text capture, so this is a screenshot)
Which means that .net 3.1 is not installed and I can't figure out the problem.
If I compile the app for 3.0, with the same CI setup, it runs.
Try force a docker image pull of the images before build yours.
Seems your aspnet:3.1
Just had the 3.1.0-preview version when you pulled It.
The 3.1 tag aims always the last 3.1.xxx version.
Before release was the preview.. now is 3.1.0... in Future Will be 3.1.x.
If you already has pulled the image with the tag 3.1 your build will used the met image. And that may not be the current 3.1 in remote repository. If you pull It the hash is verified and will update the image If needed
I use simple demo react app project and dcpkerize it .But Travic CI think that its ruby project and install ruby dependencies every commit. Why so?
travis.yml
sudo: required
services:
- docker
before_install:
- docker build -t axixa/docker-react -f Dockerfile.dev .
script:
- docker run axixa/docker-react npm run test -- --coverage
test project linkg https://github.com/ahvahsky2008/docker-react
Use language: generic at the top of your .travis.yml file.
And you do not need services: [docker] and probably not sudo: required.
This is how I am using it to test more complex apps:
# .travis.yml
language: generic
script:
- docker login -u $DOCKER_USER -p $DOCKER_PASS
- docker-compose build
- docker-compose run test
Seems like docker and docker-compose are a part of the base travis image.
I'm using Travis to build my project: https://github.com/Krijger/docker-gradle
The build uses Docker and Docker Compose. During the build, I try to stop a running container, which results in a permission denied.
https://travis-ci.org/Krijger/docker-gradle/builds/82739195
ERROR: for dockerplugin_service_1 Cannot stop container d23b7e9fc2a7bec16bdef883177d7df5582e8de2736b8623e878be6a4943c8b0:
[8] System error: permission denied
I am not alone in this issue. I'm seeing this in other Travis builds as well.
I had the same issue and had no satisfactory solution. I know this won't make an acceptable answer but I figured I could save you some time by sharing a few links.
Related issue on the TravisCI issue tracker
the kill -9 trick
similar issue on the docker-py project
It seems some succeeded with the use of the --privileged flag
Edit: it was reported that the following lines added to the .travis.yml config files does the trick:
install:
# place apparmor docker profile in complain mode
# to workaround https://github.com/travis-ci/travis-ci/issues/4661
- sudo apt-get -y update
- sudo apt-get -y install apparmor-utils
- sudo aa-complain /etc/apparmor.d/docker
For me, I just gave up TravisCI and moved to CircleCI which natively offers Docker 1.5 and also makes it possible to have Docker 1.7.1 if you start your yml file with:
machine:
pre:
# install docker 1.7.1
- sudo curl -L -o /usr/bin/docker 'https://s3-external-1.amazonaws.com/circle-downloads/docker-1.7.1-circleci'; sudo chmod 0755 / usr/bin/docker; true
services:
- docker