Docker container exits after few seconds - docker

I'm executing the following command to mount Hadoop-spark-pig-hive docker container using port mapping,
docker run -p 8088:8088 -p 50070:50070 --name hadoop-spark-pig-hive -v C:\Users\Mr.Semicolon\Desktop\iit:/resource -d suhothayan/hadoop-spark-pig-hive:2.9.2
Just to confirm it is up and running I executed the command docker ps
And it works for a few seconds only and docker container exit without any message. Please can someone suggest why this is happening and how can I solve the issue?
Note: I'm using Windows 10 Home environment and docker version 10.03.13 build 4484c46d9d
As Julien B requested I executed docker logs and got the following log message but still have no idea how to solve this,
/etc/bootstrap.sh: line 9: /usr/local/spark/conf/spark-env.sh: Permission denied
/
* Starting OpenBSD Secure Shell server sshd
...done.
Waiting for hdfs to exit from safemode
Safe mode is OFF
Started

I followed a tutorial and Following command worked for me,
docker run -it -p 8088:8088 -p 50070:50070 --name hadoop-spark-pig-hive -v C:\Users\Mr.Semicolon\Desktop\iit:/resource -d suhothayan/hadoop-spark-pig-hive:2.9.2
According to this notebook,
The -it flag tells docker that it should open an interactive container instance.

Related

Docker run WARNING: Published ports are discarded when using host network mode

I am using docker to run Nginx through the Below command:
sudo docker run --network=host -p 8443:8443 --rm --name nginx-reverse -v $(pwd)/dhparam.pem:/etc/nginx/dhparam.pem:ro -v $(pwd)/full.conf:/etc/nginx/nginx.conf:ro -v $(pwd)/cert.pem:/certs/cert.pem:ro -v $(pwd)/key.pem:/certs/key.pem:ro -d nginx:1.9.10
But getting the error Like:
WARNING: Published ports are discarded when using host network mode
ebb2cc854043438e57fdd551e1f667889add90c57f66c6015bfce93b2e5d1735
Because of this I am not able to run my container . why i am getting this can anyone please help me related this ?? why this is coming to me. I am a newbie in docker.Before it was working fine but now it is not working.
What issue am I getting. Its been up for 2 seconds. But after 2 seconds when I am doing docker ps and docker ps -a it is not showing me there. Why is this happening?

why can i not run a X11 application?

So, as the title states, I'm a docker newbie.
I downloaded and installed the archlinux/base container which seems to work great so far. I've setup a few things, and installed some packages (including xeyes) and I now would like to launch xeyes. For that I found out the CONTAINER ID by running docker ps and then used that ID in my exec command which looks now like:
$ docker exec -it -e DISPLAY=$DISPLAY 4cae1ff56eb1 xeyes
Error: Can't open display: :0
Why does it still not work though? Also, how can I stop my running instance without losing its configured state? Previously I have exited the container and all my configuration and software installations were gone when I restarted it. That was not desired. How do I handle this correctly?
Concerning the X Display you need to share the xserver socket (note: docker can't bind mount a volume during an exec) and set the $DISPLAY (example Dockerfile):
FROM archlinux/base
RUN pacman -Syyu --noconfirm xorg-xeyes
ENTRYPOINT ["xeyes"]
Build the docker image: docker build --rm --network host -t so:57733715 .
Run the docker container: docker run --rm -it -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=unix$DISPLAY so:57733715
Note: in case of No protocol specified errors you could disable host checking with xhost + but there is a warning to that (man xhost for additional information).

Attach to a container generating an exception

I have a docker container that is exiting prematurely due to an exception. I want to connect to it to debug the issue but I can't seem to keep it running in order to connect to it.
This is my initial run command:
docker run -p 8080:80 --env-file=Environment/secret.env --name starter1 starterapp
If I try:
docker attach starter1
It gives:
You cannot attach to a stopped container, start it first
If I try:
docker start -ai starter1
It starts but gives me the exception and exits.
If I try:
docker exec -i -t starter1 /bin/bash
I get:
Error response from daemon: Container 87ac5aade2d298c113bd31b50944b5095601eafc6fe29aebc046eacc76c5c2c9 is not running
I also tried:
docker run -it --rm starterapp /bin/bash -i
But it still dumps out after exception and doesn't open bash command prompt.
How do I get into a bash shell to debug the issue? The exception is generated from kestrel (webserver) due to a missing value so I should be able to access the bash prompt issue free I just cant keep it running so I can't attach to it.
Override the entrypoint with the --entrypoint parameter. You can do something like:
docker run -p 8080:80 -ti --env-file=Environment/secret.env --name starter1 --entrypoint /bin/bash starterapp

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

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.

Resources