I am trying to connect to an service (rabbitmq) from a container that I manually run in my bitbucket pipeline. But with no luck. Is this even possible?
Problem is that I have no glue what address/ip/name I could provide to my container for the service. The rabbitmq service starts fine and would be accessible under localhost:5672, but not from within my container, cause this will run in a diffrent network.
Here´s a small example what my setup looks like
image: microsoft/dotnet:sdk
pipelines:
default:
- step:
caches:
- dotnetcore
script: # Modify the commands below to build your repository.
- docker build -t company/image:tag -f ./company/service/Dockerfile ./company/service
- docker run -d --name mycontainer -p 8000:80 -e ASPNETCORE_ENVIRONMENT=Development -e MESSAGEBUS="$CONNECTIONSTRINGS__APITESTSRABBITMQ" company/image:tag
services:
- docker
- rabbitmq
definitions:
services:
rabbitmq:
image: rabbitmq:3-alpine
options:
docker: true
I have defined an environment variable CONNECTIONSTRINGS__APITESTSRABBITMQ with value rabbitmq://guest:guest@localhost:5672, but this is wrong cause rabbitmq is not accessible under this address from my container.
So is it possible to access a service from my container?
I am not sure if this is the correct way, but using --network="host" in docker run command, makes the rabbitmq is accessible via localhost from within my container
I got this error when set --network="host"
docker: Error response from daemon: cannot share the host's network namespace when user namespaces are enabled.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hey guys I'm running into the same issue, have you found a nice way of resolving it?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I used the solution with "--add-host" described here : https://community.atlassian.com/t5/Bitbucket-articles/Changes-to-make-your-containers-more-secure-on-Bitbucket/ba-p/998464
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I think became not possible after "September 2018 - Docker in Docker User Namespace Remapping" https://confluence.atlassian.com/bitbucket/infrastructure-changes-in-bitbucket-pipelines-872135046.html.
I was trying to run OWASP Zap Baseline from a docker container against the main Pipelines container and I can't access it. https://github.com/zaproxy/zaproxy/wiki/ZAP-Baseline-Scan
Any ideas on a way to do this sort of thing?
Below is a snippet from my bitbucket-pipelines.yml file
- echo "OWASP ZAP report"
- docker version
- docker run -t owasp/zap2docker-stable zap-baseline.py -t http://127.0.0.1:8080
services:
- docker
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.