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

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.

Related

How to get Docker image to run on Mac M1

I'm trying to launch SQL Server for a technical test on my Macbook. Docker seemed to be best solution.
Tried using instructions from https://database.guide/how-to-install-sql-server-on-an-m1-mac-arm64/
Installed Docker okay.
Then tried to use:
sudo docker run --cap-add SYS_PTRACE -e 'ACCEPT_EULA=1' -e 'MSSQL_SA_PASSWORD=bigStrongPwd' -p 1433:1433 --name sqledge -d mcr.microsoft.com/azure-sql-edge
But when I tried to test the Docker using:
docker ps
The result was this:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
What's gone wrong?

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?

Connection to voltdb within container fails with connection refused

According to the information on docker hub (https://hub.docker.com/r/voltdb/voltdb-community/) I was able to start the three nodes after adding the nodenames to my /etc/hosts file. Commands I executed:
docker pull voltdb/voltdb-community:latest
docker network create -d bridge voltLocalCluster
docker run -d -P -e HOST_COUNT=3 -e HOSTS=node1,node2,node3 --name=node1 --network=voltLocalCluster voltdb/voltdb-community:latest
docker run -d -P -e HOST_COUNT=3 -e HOSTS=node1,node2,node3 --name=node2 --network=voltLocalCluster voltdb/voltdb-community:latest
docker run -d -P -e HOST_COUNT=3 -e HOSTS=node1,node2,node3 --name=node3 --network=voltLocalCluster voltdb/voltdb-community:latest
docker exec -it node1 bash
sqlcmd
> Output:
Unable to connect to VoltDB cluster
localhost:21212 - Connection refused
According to log files the voltdb has started and is running normally.
Does anyone have an idea why the connection is refused?
You have to follow the given example and fix your HOSTS argument.
It should be HOSTS=node1,node2,node3 instead of yours, thus you let your service know about all nodes in cluster.
There might exists a bug in the docker-entrypoint.sh I don't see yet because I shouldn't need to connect into the container and run these commands manually, but doing this solved my issue:
docker exec -it node1 bash
voltdb init
voltdb start

cannot run container after commit changes

Just basic and simple steps illustrating what I have tried:
docker pull mysql/mysql-server
sudo docker run -i -t mysql/mysql-server:latest /bin/bash
yum install vi
vi /etc/my.cnf -> bind-address=0.0.0.0
exit
docker ps
docker commit new_image_name
docker run --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=secret -d new_image_name
docker ps -a STATUS - Exited (1)
Please let me know what I did wrong.
Instead of trying to modify an existing image, try and use (for testing) MYSQL_ROOT_HOST=%.
That would allow root login from any IP. (As seen in docker-library/mysql issue 241)
sudo docker run --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 -e MYSQL_ROOT_HOST=% -d mysql/mysql-server:latest
The README mentions:
By default, MySQL creates the 'root'#'localhost' account.
This account can only be connected to from inside the container, requiring the use of the docker exec command as noted under Connect to MySQL from the MySQL Command Line Client.
To allow connections from other hosts, set this environment variable.
As an example, the value "172.17.0.1", which is the default Docker gateway IP, will allow connections from the Docker host machine.

Execute docker command with deis

I have deis(1.5.2) with 3 host and I want "app" with database. I want to use postgres, so I found this docker image https://registry.hub.docker.com/_/postgres/ . I did deploy without problems, but I don't know how can I connect into this app/container (create some db, users) and link with other app/container. They write commands for it but it's for docker. So how can I run these commands from deis:
docker run --name some-app --link some-postgres:postgres -d application-that-uses-postgres
docker run -it --link some-postgres:postgres --rm postgres sh -c 'exec psql -h "$POSTGRES_PORT_5432_TCP_ADDR" -p "$POSTGRES_PORT_5432_TCP_PORT" -U postgres'
or do you have some other solution for using DB with deis?

Resources