Command failed docker-compose in VScode Devcontainer - docker

I've just started using Docker on an already existing project (it runs into a Docker container). I don't have a lot of Docker background - I've been using it only from the GUI, by pressing the "play" button.
Now I have a project which runs into a container, and I'm having trouble starting it.
I'm getting this error:
[2022-03-31T15:30:27.408Z] Error: Command failed: docker-compose -f c:\Users\Octavian\Desktop\django-analyzer\docker-compose.dev.yml config
[2022-03-31T15:30:27.408Z] at Ru (c:\Users\Octavian\.vscode\extensions\ms-vscode-remote.remote-containers-0.231.1\dist\spec-node\devContainersSpecCLI.js:209:813)
[2022-03-31T15:30:27.408Z] at processTicksAndRejections (node:internal/process/task_queues:96:5)
[2022-03-31T15:30:27.408Z] at async dR (c:\Users\Octavian\.vscode\extensions\ms-vscode-remote.remote-containers-0.231.1\dist\spec-node\devContainersSpecCLI.js:181:643)
[2022-03-31T15:30:27.408Z] at async hR (c:\Users\Octavian\.vscode\extensions\ms-vscode-remote.remote-containers-0.231.1\dist\spec-node\devContainersSpecCLI.js:178:2075)
[2022-03-31T15:30:27.408Z] at async RR (c:\Users\Octavian\.vscode\extensions\ms-vscode-remote.remote-containers-0.231.1\dist\spec-node\devContainersSpecCLI.js:223:2195)
[2022-03-31T15:30:27.408Z] at async Jw (c:\Users\Octavian\.vscode\extensions\ms-vscode-remote.remote-containers-0.231.1\dist\spec-node\devContainersSpecCLI.js:223:3221)
[2022-03-31T15:30:27.409Z] at async TR (c:\Users\Octavian\.vscode\extensions\ms-vscode-remote.remote-containers-0.231.1\dist\spec-node\devContainersSpecCLI.js:223:13880)
[2022-03-31T15:30:27.409Z] at async FR (c:\Users\Octavian\.vscode\extensions\ms-vscode-remote.remote-containers-0.231.1\dist\spec-node\devContainersSpecCLI.js:223:13605)
[2022-03-31T15:30:27.417Z] Stop (3507 ms): Run: C:\Users\Octavian\AppData\Local\Programs\Microsoft VS Code\Code.exe c:\Users\Octavian\.vscode\extensions\ms-vscode-remote.remote-containers-0.231.1\dist\spec-node\devContainersSpecCLI.js up --container-data-folder .vscode-server/data/Machine --container-system-data-folder /var/vscode-server --workspace-folder c:\Users\Octavian\Desktop\django-analyzer --workspace-mount-consistency cached --id-label vsch.local.folder=c:\Users\Octavian\Desktop\django-analyzer --id-label vsch.quality=stable --log-level debug --config c:\Users\Octavian\Desktop\django-analyzer\.devcontainer\devcontainer.json --mount type=volume,source=vscode,target=/vscode,external=true --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root true
[2022-03-31T15:30:27.417Z] Exit code 1
[2022-03-31T15:30:27.420Z] Command failed: C:\Users\Octavian\AppData\Local\Programs\Microsoft VS Code\Code.exe c:\Users\Octavian\.vscode\extensions\ms-vscode-remote.remote-containers-0.231.1\dist\spec-node\devContainersSpecCLI.js up --container-data-folder .vscode-server/data/Machine --container-system-data-folder /var/vscode-server --workspace-folder c:\Users\Octavian\Desktop\django-analyzer --workspace-mount-consistency cached --id-label vsch.local.folder=c:\Users\Octavian\Desktop\django-analyzer --id-label vsch.quality=stable --log-level debug --config c:\Users\Octavian\Desktop\django-analyzer\.devcontainer\devcontainer.json --mount type=volume,source=vscode,target=/vscode,external=true --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root true
[2022-03-31T15:30:27.421Z] Exit code 1
Here's my docker-compose.yml (if it helps)
version: '3.7'
services:
redis:
//data
postgres:
//data
django:
//data
volumes:
db-data:
Where can this error come from and how can I fix it?
Thanks.

It looks like you're trying to VS Code devcontainers. The error output is not super helpful here.
docker-compose seems to not like the format of your docker-compose.dev.yml file because it errors out on:
docker-compose -f c:\Users\Octavian\Desktop\django-analyzer\docker-compose.dev.yml config
Try running that command at your command line and it should give you better info on why your docker-compose.dev.yml is invalid.

I just ran into this problem myself and the issue was that my compose file wasn't compatible with the V1 compose command-line. Going into the Docker Desktop general preferences and enabling "Use Docker Compose V2" fixed it.

Try to check your docker version. then select the appropriate compactibility version from HERE then try this for official HERE or you can try this one for template compose file HERE
Make sure your docker is propery installed on your local machine.

Related

reopen container error from visual studio code 1_72_1

I am trying to reopen containers from VS Code 1.72.1, with below docker version details
Docker version 20.10.17, build 100c701
docker-compose version 1.29.2,
build unknown
ubuntu 18.04
When I reopen container getting below error:
ERROR: .PermissionError: [Errno 13] Permission denied: '/home//.config/Code/User/globalStorage/ms-vscode-remote.remote-containers/data/docker-compose/docker-compose.devcontainer.build-1669200324912.yml'
I have /home//.config/Code/User/globalStorage/ms-vscode-remote.remote-containers/data/docker-compose file status -rw-rw-r-- and docker-compose folder ownership is also based on user so there is looking perfect for me.
From remote container log find below details:
[2022-11-23T12:40:16.793Z] Start: Run: docker-compose --project-name test_devcontainer -f /home//WorkSpace/test/25072022/test/.devcontainer/docker-compose.yml -f /home//.config/Code/User/globalStorage/ms-vscode-remote.remote-containers/data/docker-compose/docker-compose.devcontainer.build-1669207216791.yml build
[2022-11-23T12:40:18.864Z] /snap/docker/2285/lib/python3.6/site-packages/paramiko/transport.py:33: CryptographyDeprecationWarning: Python 3.6 is no longer supported by the Python core team. Therefore, support for it is deprecated in cryptography and will be removed in a future release.
[2022-11-23T12:40:18.870Z] from cryptography.hazmat.backends import default_backend
[2022-11-23T12:40:20.792Z] ERROR: .PermissionError: [Errno 13] Permission denied: '/home//.config/Code/User/globalStorage/ms-vscode-remote.remote-containers/data/docker-compose/docker-compose.devcontainer.build-1669207216791.yml'
[2022-11-23T12:40:20.979Z] Stop (4186 ms): Run: docker-compose --project-name test_devcontainer -f /home//WorkSpace/test/25072022/test/.devcontainer/docker-compose.yml -f /home//.config/Code/User/globalStorage/ms-vscode-remote.remote-containers/data/docker-compose/docker-compose.devcontainer.build-1669207216791.yml build
[2022-11-23T12:40:20.980Z] Error: Command failed: docker-compose --project-name test_devcontainer -f /home//WorkSpace/test/25072022/test/.devcontainer/docker-compose.yml -f /home//.config/Code/User/globalStorage/ms-vscode-remote.remote-containers/data/docker-compose/docker-compose.devcontainer.build-1669207216791.yml build
[2022-11-23T12:40:20.981Z] at cF (/home//.vscode/extensions/ms-vscode-remote.remote-containers-0.262.3/dist/spec-node/devContainersSpecCLI.js:1849:431)
[2022-11-23T12:40:20.981Z] at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
[2022-11-23T12:40:20.981Z] at async eoe (/home//.vscode/extensions/ms-vscode-remote.remote-containers-0.262.3/dist/spec-node/devContainersSpecCLI.js:1849:2433)
[2022-11-23T12:40:20.981Z] at async Qse (/home//.vscode/extensions/ms-vscode-remote.remote-containers-0.262.3/dist/spec-node/devContainersSpecCLI.js:1831:2396)
[2022-11-23T12:40:20.981Z] at async voe (/home//.vscode/extensions/ms-vscode-remote.remote-containers-0.262.3/dist/spec-node/devContainersSpecCLI.js:1893:2222)
[2022-11-23T12:40:20.981Z] at async Xf (/home//.vscode/extensions/ms-vscode-remote.remote-containers-0.262.3/dist/spec-node/devContainersSpecCLI.js:1893:3212)
[2022-11-23T12:40:20.981Z] at async Jae (/home//.vscode/extensions/ms-vscode-remote.remote-containers-0.262.3/dist/spec-node/devContainersSpecCLI.js:2013:15058)
[2022-11-23T12:40:20.981Z] at async Wae (/home//.vscode/extensions/ms-vscode-remote.remote-containers-0.262.3/dist/spec-node/devContainersSpecCLI.js:2013:14812)

Docker-in-Docker issues with connecting to internal container network (Anchore Engine)

I am having issues when trying to connect to a docker-compose network from inside of a container. These are the files I am working with. The whole thing runs when I ./run.sh.
Dockerfile:
FROM docker/compose:latest
WORKDIR .
# EXPOSE 8228
RUN apk update
RUN apk add py-pip
RUN apk add jq
RUN pip install anchorecli
COPY dockertest.sh ./dockertest.sh
COPY docker-compose.yaml docker-compose.yaml
CMD ["./dockertest.sh"]
docker-compose.yaml
services:
# The primary API endpoint service
engine-api:
image: anchore/anchore-engine:v0.6.0
depends_on:
- anchore-db
- engine-catalog
#volumes:
#- ./config-engine.yaml:/config/config.yaml:z
ports:
- "8228:8228"
..................
## A NUMBER OF OTHER CONTAINERS THAT ANCHORE-ENGINE USES ##
..................
networks:
default:
external:
name: anchore-net
dockertest.sh
echo "------------- INSTALL ANCHORE CLI ---------------------"
engineid=`docker ps | grep engine-api | cut -f 1 -d ' '`
engine_ip=`docker inspect $engineid | jq -r '.[0].NetworkSettings.Networks."cws-anchore-net".IPAddress'`
export ANCHORE_CLI_URL=http://$engine_ip:8228/v1
export ANCHORE_CLI_USER='user'
export ANCHORE_CLI_PASS='pass'
echo "System status"
anchore-cli --debug system status #This line throws error (see below)
run.sh:
#!/bin/bash
docker build . -t anchore-runner
docker network create anchore-net
docker-compose up -d
docker run --network="anchore-net" -v //var/run/docker.sock:/var/run/docker.sock anchore-runner
#docker network rm anchore-net
Error Message:
System status
INFO:anchorecli.clients.apiexternal:As Account = None
DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): 172.19.0.6:8228
Error: could not access anchore service (user=user url=http://172.19.0.6:8228/v1): HTTPConnectionPool(host='172.19.0.6', port=8228): Max retries exceeded with url: /v1
(Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused',))
Steps:
run.sh builds container image and creates network anchore-net
the container has an entrypoint script, which does multiple things
firstly, it brings up the docker-compose network as detached FROM inside the container
secondly, nstalls anchore-cli so I can run commands against container network
lastly, attempts to get a system status of the anchore-engine (d.c network) but thats where I am running into HTTP request connection issues.
I am dynamically getting the IP of the api endpoint container of anchore-engine and setting the URL of the request to do that. I have also tried passing those variables from command line such as:
anchore-cli --u user --p pass --url http://$engine_ip/8228/v1 system status but that throws the same error.
For those of you who took the time to read through this, I highly appreciate any input you can give me as to where the issue may be lying. Thank you very much.

Filebeat not running using docker-compose: setting 'filebeat.prospectors' has been removed

I'm trying to launch filebeat using docker-compose (I intend to add other services later on) but every time I execute the docker-compose.yml file, the filebeat service always ends up with the following error:
filebeat_1 | 2019-08-01T14:01:02.750Z ERROR instance/beat.go:877 Exiting: 1 error: setting 'filebeat.prospectors' has been removed
filebeat_1 | Exiting: 1 error: setting 'filebeat.prospectors' has been removed
I discovered the error by accessing the docker-compose logs.
My docker-compose file is as simple as it can be at the moment. It simply calls a filebeat Dockerfile and launches the service immediately after.
Next to my Dockerfile for filebeat I have a simple config file (filebeat.yml), which is copied to the container, replacing the default filebeat.yml.
If I execute the Dockerfile using the docker command, the filebeat instance works just fine: it uses my config file and identifies the "output.json" file as well.
I'm currently using version 7.2 of filebeat and I know that the "filebeat.prospectors" isn't being used. I also know for sure that this specific configuration isn't coming from my filebeat.yml file (you'll find it below).
It seems that, when using docker-compose, the container is accessing another configuration file instead of the one that is being copied to the container, by the Dockerfile, but so far I haven't been able to figure it out how, why and how can I fix it...
Here's my docker-compose.yml file:
version: "3.7"
services:
filebeat:
build: "./filebeat"
command: filebeat -e -strict.perms=false
The filebeat.yml file:
filebeat.inputs:
- paths:
- '/usr/share/filebeat/*.json'
fields_under_root: true
fields:
tags: ['json']
output:
logstash:
hosts: ['localhost:5044']
The Dockerfile file:
FROM docker.elastic.co/beats/filebeat:7.2.0
COPY filebeat.yml /usr/share/filebeat/filebeat.yml
COPY output.json /usr/share/filebeat/output.json
USER root
RUN chown root:filebeat /usr/share/filebeat/filebeat.yml
RUN mkdir /usr/share/filebeat/dockerlogs
USER filebeat
The output I'm expecting should be similar to the following, which comes from the successful executions I'm getting when I'm executing it as a single container.
The ERROR is expected because I don't have logstash configured at the moment.
INFO crawler/crawler.go:72 Loading Inputs: 1
INFO log/input.go:148 Configured paths: [/usr/share/filebeat/*.json]
INFO input/input.go:114 Starting input of type: log; ID: 2772412032856660548
INFO crawler/crawler.go:106 Loading and starting Inputs completed. Enabled inputs: 1
INFO log/harvester.go:253 Harvester started for file: /usr/share/filebeat/output.json
INFO pipeline/output.go:95 Connecting to backoff(async(tcp://localhost:5044))
ERROR pipeline/output.go:100 Failed to connect to backoff(async(tcp://localhost:5044)): dial tcp [::1]:5044: connect: cannot assign requested address
INFO pipeline/output.go:93 Attempting to reconnect to backoff(async(tcp://localhost:5044)) with 1 reconnect attempt(s)
ERROR pipeline/output.go:100 Failed to connect to backoff(async(tcp://localhost:5044)): dial tcp [::1]:5044: connect: cannot assign requested address
INFO pipeline/output.go:93 Attempting to reconnect to backoff(async(tcp://localhost:5044)) with 2 reconnect attempt(s)
I managed to figure out what the problem was.
I needed to map the location of the config file and logs directory in the docker-compose file, using the volumes tag:
version: "3.7"
services:
filebeat:
build: "./filebeat"
command: filebeat -e -strict.perms=false
volumes:
- ./filebeat/filebeat.yml:/usr/share/filebeat/filebeat.yml
- ./filebeat/logs:/usr/share/filebeat/dockerlogs
Finally I just had to execute the docker-compose command and everything start working properly:
docker-compose -f docker-compose.yml up -d

Connection to docker container failing because of postgis port issue

My docker container is able to successfully build but when I enter the command docker-compose build, the following error is returned:
Starting docker_etl_1 ...
Starting 1e5f56853e10_1e5f56853e10_1e5f56853e10_docker_postgis_1 ...
Starting 1e5f56853e10_1e5f56853e10_1e5f56853e10_docker_postgis_1
Starting 1e5f56853e10_1e5f56853e10_1e5f56853e10_docker_postgis_1 ... error
ERROR: for 1e5f56853e10_1e5f56853e10_1e5f56853e10_docker_postgis_1 Cannot start service postgis: driver failed programming external connectivity on endpoint 1e5f56853e10_1e5f56853e10_1e5f56853e10_docker_postgis_1 (91464afbee8bf7212061797ec0f4c017a56cc3c30c9bdaf513127a6e6a4a5a52): Error starting userland prStarting docker_etl_1 ... done
ERROR: for postgis Cannot start service postgis: driver failed programming external connectivity on endpoint 1e5f56853e10_1e5f56853e10_1e5f56853e10_docker_postgis_1 (91464afbee8bf7212061797ec0f4c017a56cc3c30c9bdaf513127a6e6a4a5a52): Error starting userland proxy: Bind for 0.0.0.0:5432 failed: port is already allocated
Here is my docker-compose.yaml
version: '2'
services:
postgis:
build: ./postgis
volumes:
- ../src/main/sql:/sql
ports:
- "5432:5432"
etl:
build: ./etl
volumes:
- ..:/national-voter-file
entrypoint:
- python3
- /national-voter-file/load/loader.py
and here is the Dockerfile:
FROM mdillon/postgis:9.5
ENV POSTGRES_DB VOTER
RUN mkdir /sql
COPY ./dockerResources/z-init-db.sh /docker-entrypoint-initdb.d/
EXPOSE 5432
Docker ps -a returns:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
da74ad97b95c docker_postgis "docker-entrypoint..." About a minute ago Created docker_postgis_1
5872c6e55fe2 docker_etl "python3 /national..." About a minute ago Exited (2) About a minute ago docker_etl_1
However, when I try rm $(docker ps -qa) I get the following error:
rm: da74ad97b95c: No such file or directory
rm: 5872c6e55fe2: No such file or directory
I don't believe I have another container running so I'm confused by the message Bind for 0.0.0.0:5432 failed: port is already allocated
Is it possible that you ran the same docker-compose earlier, which probably failed or at least failed to clean up the services?
Try running docker ps -a to check if any stopped containers exist. It is possible that the stopped containers are hogging the port. If so, just clear them out using docker rm $(docker ps -qa)

Live migration of a jboss/wildfly container with CRIU failed

I've tried to live migrate a wildfly-container to another host like described here. The example with the np container works well. When I replace the example with a simple jboss/wildfly container, I just received this error when criu tries to restore the container on the other host :
Error response from daemon: Cannot restore container <CONTAINER-ID>: criu failed: type NOTIFY errno 0
Error: failed to restore one or more containers
Because I didn't found a solution to this error, I've compiled the linux kernel like described on the criu website and here.
After that sudo criu check prints:
Warn (criu/libnetlink.c:54): ERROR -2 reported by netlink
Warn (criu/libnetlink.c:54): ERROR -2 reported by netlink
Warn (criu/sockets.c:711): The current kernel doesn't support packet_diag
Warn (criu/libnetlink.c:54): ERROR -2 reported by netlink
Warn (criu/sockets.c:721): The current kernel doesn't support netlink_diag
Info prctl: PR_SET_MM_MAP_SIZE is not supported
Looks good.
criu --version
Version: 2.11
docker --version
Docker version 1.6.2, build 7c8fca2
Checkpoint/Restore for an example shell script example worked very well. But when I want to checkpoint a container
docker run -d --name looper busybox /bin/sh -c 'i=0; while true; do echo $i; i=$(expr $i + 1); sleep 1; done'
with
criu dump -t $PID --images-dir /tmp/looper
I receive this output
Error (criu/sockets.c:132): Diag module missing (-2)
Error (criu/sockets.c:132): Diag module missing (-2)
Error (criu/sockets.c:132): Diag module missing (-2)
Error (criu/mount.c:701): mnt: 87:./etc/hosts doesn't have a proper root mount
Error (criu/cr-dump.c:1641): Dumping FAILED.`
I can't find some solutions with these errors. Is there any known solution to live migrate a wildfly-container?
Thanks in advance

Resources