How to run "--verbose" for wiremock in docker compose file - docker

I want to get verbose output from mockwire when running in docker using docker compose file.
I tried these three ways but none of them work.
first way
services:
wiremock:
image: wiremock
ports:
- 8080:8080
restart: always
volumes:
- ./myfolder/mystuff:/home/wiremock
command: [--verbose]
second way
command: --verbose
third way
command:
- --verbose
I keep getting the error:
wiremock exec: "--verbose": executable file not found in $PATH: unknown

I've set up it in this way:
mocked-services:
image: wiremock/wiremock:2.33.2
command: "--global-response-templating --verbose"

Related

Command "docker-compose up" results in "command not found : no mount point specified" error

I am trying to modify an Expressvpn container I found online. I cloned the repository to create my own modified image from it. I have spend all day trying to create a new image without modifying the existing code.
All I did was add a docker-compose.yml file to the directory as specified on the Github page:
---
version: "2.1"
services:
expressvpn_test:
build:
context: .
dockerfile: Dockerfile
container_name: expressvpn_test
environment:
- ACTIVATION_CODE={% your-activation-code %}
cap_add:
- NET_ADMIN
devices:
- /dev/net/tun
stdin_open: true
tty: true
command: /bin/bash
privileged: true
restart: unless-stopped
ports:
- 80:80 # example
When I run the command "docker-compose up" in the directory of the repository I get the following error:
/tmp/entrypoint.sh: line 2: $'\r': command not found
: no mount point specified.
cp: cannot stat '/tmp/resolv.conf': No such file or directory
/etc/init.d/expressvpn: line 207: log_action_msg: command not found
": no such file or directoryressvpnActivate.sh
Cannot connect to expressvpnd daemon.
It seems that the expressvpn daemon is not running. Please run "sudo service expressvpn restart" to
start it.
If the problem persists, please contact us.
: No such file or directory /bin/bash
If I pull the original image and run it there are no problems. I am new to Docker and I can't seem to figure out how I can solve this.
I hope someone can help me out with this problem.

Issue with docker not acknowledging docker-compose.override.yml

I'm particularly new to Docker. I was trying to containerize a project for development and production versions. I came up with a very basic docker-compose configuration and then tried the override feature which doesn't seem to work.
I added overrides for volumes to web and celery services which do not actually mount to the container, can confirm the same by looking at the inspect log of both the containers.
Contents of compose files:-
docker-compose.yml
version: '3'
services:
web:
build: .
command: python manage.py runserver 0.0.0.0:8000
depends_on:
- redis
redis:
image: redis:5.0.9-alpine
celery:
build: .
command: celery worker -A facedetect.celeryapp -l INFO --concurrency=1 --without-gossip --without-heartbeat
depends_on:
- redis
environment:
- C_FORCE_ROOT=true
docker-compose.override.yml
version: '3'
services:
web:
volumes:
- .:/code
ports:
- "8000:8000"
celery:
volumes:
- .:/code
I use Docker with Pycharm on Windows 10.
Command executed to deploy the compose configuration:-
C:\Program Files\Docker Toolbox\docker-compose.exe" -f <full-path>/docker-compose.yml up -d
Command executed to inspect one of the containers:-
docker container inspect <container_id>
Any help would be appreciated! :)
Just figured out that I had provided the docker-compose.yml file explicitly to the Run Configuration created in Pycharm as it was mandatory to provide at least one of these.
The command used by Pycharm explicitly mentions the .yml files using -f option when running the configuration. Adding the docker-compose.override.yml file to the Run Configuration changed the command to
C:\Program Files\Docker Toolbox\docker-compose.exe" -f <full_path>\docker-compose.yml -f <full_path>/docker-compose.override.yml up -d
This solved the issue. Thanks to Exadra37 directing to look out for the command that was being executed.

Why doesn't DynamoDB local recognize -shareDB option?

I'm trying to start a DynamoDB Local Docker container with the -shareDb option but it failes with the message "Error while parsing options. Unrecognized option: -shareDb".
The docker image is from amazon/dynamodb-local and I'm starting using a docker-compose file.
The container starts okay without the -shareDb option.
Below is the docker-compose file I'm using:
version: '3'
services:
dynamodb:
image: amazon/dynamodb-local
ports:
- "8000:8000"
command: "-jar DynamoDBLocal.jar -shareDb -dbPath ."
app:
Based on docs https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.DownloadingAndRunning.html , its not -shareDb but -sharedDb

Docker Compose with shell environment variable error

I'm running a Docker deployment for an application. I'm mounting a volume where I want the external path to be provided by a shell environment variable. I get this error:
ERROR: for video-server Cannot create container for service video-server: invalid volume specification: '46b9d2fb3b9b13c9404d31bae571dac3f633122393c4a77f2561afb8aed5c06e:=/opt/videos:rw': invalid mount config for type "volume": invalid mount path: '=/opt/videos' mount path must be absolute
My docker-compose configuration is this:
video-server:
build:
context: .
dockerfile: video-server_Dockerfile
container_name: video-server
networks:
- videoManagerNetwork
environment:
- VIDEO_MANAGER_DIR=/opt/videos
volumes:
- ${VIDEO_MANAGER_DIR_PROD}=/opt/videos
ports:
- 9000:8080
I can see the correct value of the VIDEO_MANAGER_DIR_PROD environment variable by doing both of these commands, so I know it's on my shell:
echo $VIDEO_MANAGER_DIR_PROD
sudo echo $VIDEO_MANAGER_DIR_PROD
What's strange is that, if I do a complete wipe of my docker configurations (sudo docker system prune --all --volumes), and then run the docker-compose for the first time (sudo docker-compose up -d), everything works.
However, if I take the container down, rebuild it, and try to run that same command (sudo docker-compose up -d) again, then I get the error displayed above.
You cannot assign the source volume like a variable, so you will use : for this assignment.
Documentation about Docker Compose volumes: docs.docker.com
video-server:
build:
context: .
dockerfile: video-server_Dockerfile
container_name: video-server
networks:
- videoManagerNetwork
environment:
- VIDEO_MANAGER_DIR: /opt/videos
volumes:
- ${VIDEO_MANAGER_DIR_PROD}:/opt/videos
ports:
- 9000:8080

Set secomp to unconfined in docker-compose

I need to be able fork a process. As i understand it i need to set the security-opt. I have tried doing this with docker command and it works fine. However when i do this in a docker-compose file it seem to do nothing, maybe I'm not using compose right.
Docker
docker run --security-opt=seccomp:unconfined <id> dlv debug --listen=:2345 --headless --log ./cmd/main.go
Docker-compose
Setup
docker-compose.yml
networks:
backend:
services:
example:
build: .
security_opt:
- seccomp:unconfined
networks:
- backend
ports:
- "5002:5002"
Dockerfile
FROM golang:1.8
RUN go get -u github.com/derekparker/delve/cmd/dlv
RUN dlv debug --listen=:2345 --headless --log ./cmd/main.go
command
docker-compose -f docker-compose.yml up --build --abort-on-container-exit
Result
2017/09/04 15:58:33 server.go:73: Using API v1 2017/09/04 15:58:33
debugger.go:97: launching process with args: [/go/src/debug] could not
launch process: fork/exec /go/src/debug: operation not permitted
The compose syntax is correct. But the security_opt will be applied to the new instance of the container and thus is not available at build time like you are trying to do with the Dockerfile RUN command.
The correct way should be :
Dockerfile:
FROM golang:1.8
RUN go get -u github.com/derekparker/delve/cmd/dlv
docker-compose.yml
networks:
backend:
services:
example:
build: .
security_opt:
- seccomp:unconfined
networks:
- backend
ports:
- "5002:5002"
entrypoint: ['/usr/local/bin/dlv', '--listen=: 2345', '--headless=true', '--api-version=2', 'exec', 'cmd/main.go']

Resources