You don't have permission to access / on this server docker - docker

I want to start a container from that image:
sudo docker run --name phpldapadmin -p 2222:80 -p 2443:443 -e LDAP_HOST=ldap.example.com -e LDAP_LOGIN_DN=cn=admin,dc=example,dc=com --link openldap:ldap-host --detach osixia/phpldapadmin:0.7.0 --copy-service
But when I'm visiting my localhost:2222 I see:
Forbidden
You don't have permission to access / on this server.
So my question is: How do I have to start my container properly? What am I doing wrong here.

Related

Keycloak running in docker and connecting to local mariaDB

I try to setup keycloak as a docker container using a mariaDB Server which is installed on the host machine. The mariaDB Server should not run in a Docker container.
I try to run keycloak by this command:
docker run -d --name keycloak -p 8443:8443 -v /opt/keycloak/certs:/etc/x509/https --net staticNet --ip 172.18.0.10 -e KEYCLOAK_USER=admin -e KEYCLOAK_PASSWORD='password' -e DB_VENDOR=mariadb -e DB_ADDR=host.docker.internal -e DB_DATABASE=keycloak -e DB_USERNAME=keycloak -e DB_PASSWORD='dbUserPassword' jboss/keycloak
The Network was created with: docker network create --subnet=172.18.0.0/16 staticNet
But keycload fails to start with error that it is not able to connect to the database host.
Is there something missing in my network Configuration? Or is something wrong with my docker run? Or do I need some special configuration for my mariaDB Server?

Can we run docker inside a docker container which is running in a virtual-box of Ubuntu 18.04?

I want to run docker inside another docker container. My main container is running in a virtualbox of OS Ubuntu 18.04 which is there on my Windows 10. On trying to run it, it is showing me as:
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
How can I resolve this issue?
Yes, you can do this. Check for dind (docker in docker) on docker webpage how to achieve it: https://hub.docker.com/_/docker
Your error indicates that either dockerd in the top level container is not running or you didn't mount docker.sock on the dependent container to communicate with dockerd running on your top-level container.
I am running electric-flow in a docker container in my Ubuntu virtual-box using this docker command: docker run --name efserver --hostname=efserver -d -p 8080:8080 -p 9990:9990 -p 7800:7800 -p 7070:80 -p 443:443 -p 8443:8443 -p 8200:8200 -i -t ecdocker/eflow-ce. Inside this docker container, I want to install and run docker so that my CI/CD pipeline in electric-flow can access and use docker commands.
From your above description, ecdocker/eflow-ce is your CI/CD solution container, and you just want to use docker command in this container, then you did not need dind solution. You can just access to a container's host docker server.
Something like follows:
docker run --privileged --name efserver --hostname=efserver -d -p 8080:8080 -p 9990:9990 -p 7800:7800 -p 7070:80 -p 443:443 -p 8443:8443 -p 8200:8200 -v $(which docker):/usr/bin/docker -v /var/run/docker.sock:/var/run/docker.sock -i -t ecdocker/eflow-ce
Compared to your old command:
Add --privileged
Add -v $(which docker):/usr/bin/docker, then you can use docker client in container.
Add -v /var/run/docker.sock:/var/run/docker.sock, then you can access host's docker daemon using client in container.

Cannot connect to keycloak admin panel

I've followed this tutorial and run keycloak with postgres via Docker. Since port 8080 is already in use by my front-end app, it used 9990 instead.
As the logs say:
13:26:00,602 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://127.0.0.1:9990/management
13:26:00,603 INFO [org.jboss.as] (Controller Boot Thread)
WFLYSRV0051: Admin console listening on http://127.0.0.1:9990
But when I go to these urls through my browser, nothing happens. I've also tried going to http://127.0.0.1:9990/auth/admin/ and it doesn't work to. When I try to connect, nothing appears in my keycloak console.
I've followed the tutorial without any additional settings. What's wrong?
Firstly I create a user define network:
docker network create keycloak-network
Then I run postgres:
docker run -d --name postgres --net keycloak-network -e POSTGRES_DB=keycloak -e POSTGRES_USER=keycloak -e POSTGRES_PASSWORD=password postgres
And Finally Keycloak:
docker run --name keycloak --net keycloak-network jboss/keycloak
You need to publish ports (8080 for http, 8443 for https) of the Keycloak container + remap ports, because 8080 is already used on your machine. For example:
docker run --rm \
--name keycloak \
--net keycloak-network \
-e KEYCLOAK_USER=myadmin \
-e KEYCLOAK_PASSWORD=mypassword \
-p 9990:8080 \
-p 9991:8443 \
jboss/keycloak
Keycloak admin UI will be available on:
http://<ip of the host machine\>:9990/
https://<ip of the host machine\>:9991/ (self signed cert will be generated in this case, so you will need to approve TLS exception in the browser)
If someone else like me will start his way in Docker from installing Keycloak asap.
Full path to install Keycloak on Docker and then have access to web UI via port 9990 (you can change it in last command):
docker network create keycloak-network
docker run -d --name postgres --net keycloak-network -e POSTGRES_DB=keycloak -e POSTGRES_USER=keycloak -e POSTGRES_PASSWORD=password postgres
docker run --rm --name keycloak --net keycloak-network -e KEYCLOAK_USER=myadmin -e KEYCLOAK_PASSWORD=mypassword -e DB_USER=keycloak -e DB_PASSWORD=password -p 9990:8080 -p 9991:8443 jboss/keycloak
Difference from topickstarter's and previous answer is avoiding of error below:
"WFLYCTL0113: '' is an invalid value for parameter user-name
by providing DB username and password in last command.

pact-broker docker image is not running after restarting docker machine

I am using Postgres image and past broker image in my docker machine for setting up pact broker.
here are 4 steps that have mentioned :
1.$ docker run --name pactbroker-db -e POSTGRES_PASSWORD=ThePostgresPassword -e POSTGRES_USER=admin -e PGDATA=/var/lib/postgresql/data/pgdata -v /var/lib/postgresql/data:/var/lib/postgresql/data -d postgres
2.$ docker run -it --link pactbroker-db:postgres --rm postgres sh -c 'exec psql -h "$POSTGRES_PORT_5432_TCP_ADDR" -p "$POSTGRES_PORT_5432_TCP_PORT" -U admin'
3.
CREATE USER pactbrokeruser WITH PASSWORD 'TheUserPassword';
CREATE DATABASE pactbroker WITH OWNER pactbrokeruser;
GRANT ALL PRIVILEGES ON DATABASE pactbroker TO pactbrokeruser;
4. docker run --name pactbroker --link pactbroker-db:postgres -e PACT_BROKER_DATABASE_USERNAME=pactbrokeruser -e PACT_BROKER_DATABASE_PASSWORD=TheUserPassword -e PACT_BROKER_DATABASE_HOST=postgres -e PACT_BROKER_DATABASE_NAME=pactbroker -d -p 80:80 dius/pact_broker
after running this 4 command when I am opening Hal browser in my local system it is working pretty fine. Now I am stopping 2 docker containers pactbroker-db and pactbroker and stopping docker machine.
After sometime I am restarting docker machine and starting the containers by
$docker start pactbroker-db and $docker start pactbroker .
containers are getting started but when opening HAL browser I am getting the error "We're sorry, but something went wrong." screenshot attached.
Is there something wrong when I am starting the docker 2nd time?enter image description here
This has been resolved by using container given in https://github.com/DiUS/pact_broker-docker and using proper environment variables in docker-compose.yml of this project.

docker mounted volume data getting wiped after restart the server

I am trying with docker. I ran kong docker Image and linked it with cassandra database which is mounted to the folder /data/api. but whenever I restart the server I am not able to see the mounted volume and all the data in the db lost.
here is the command which i am using
docker run -d --name kong-database -p 9042:9042 -v /data/api:/var/lib/cassandra cassandra:2.2
after i run db docker image I am running kong
docker run --privileged -d --name kong --link kong-database:kong-database -e "KONG_DATABASE=cassandra" -e "KONG_CASSANDRA_CONTACT_POINTS=kong-database" -e
"KONG_PG_HOST=kong-database" -p 80:8000 -p 443:8443 -p 7001:7001 -p 7946:7946 -p 7946:7946/udp kong
my kong entries are there mounted to the folder /data/api. but when I restarted my servercouldn't see the folder /data/api
because of this reason I am stuck at my work. can anyone help me on this?
Thanks in advance,

Resources