Docker Oracle DB container : error response from daemon no command specified - oracle

Hello I hope you all doing good please im trying to create a container for a DB and i have this error :
error response from daemon no command specified
this is my command
docker create --name soadb --hostname=bbddsoa --network=soadevNET -p 1521:1521 -p 5500:5500 -e TZ=Europe/Madrid -v %cd%\DBVolume:/ORCL --env-file %cd%\db.env.list -it --shm-size="8g" soadb:v0.3
i know at the end of the command i should add a command but i dont know what
thank you in advance .

Related

Connect to postgres on docker container via localhost is failed

I'm constructing a postgres server on docker container by docker run command as follows (environmental parameters are set properly).
docker run \
--name zero2prod \
-e POSTGRES_USER=${DB_USER} \
-e POSTGRES_PASSWORD=${DB_PASSWORD} \
-e POSTGRES_DB=${DB_NAME} \
-p "${DB_PORT}":5432 \
-d postgres \
postgres -N 1000
But, psql command failed to connect the server. I typed the command as follows.
PGPASSWORD="${DB_PASSWORD}" psql -h "localhost" -U "${DB_USER}" -p "${DB_PORT}" -d "postgres"
The error message is this.
psql: error: could not connect to server: FATAL: password authentication failed for user "postgres"
Does anyone knows why the command failed?
Note: I'm using windows 10 machine and docker environment was installed using Docker Desktop for Windows.
I found an solution.
psql command executed successfully. I changed p option of docker run changed as follows.
Before : -p 5432:5432
After : -p 5555:5432
I don't know why psql command failed when the host port is same with container port 5432.

Get the name of running docker container inside shell script

I am currently developing an application, in which I want to automate a testing process to speed up my development time. I use a postgres db container, and I then want to check that the preparation of the database is correct.
My process is currently as follows:
docker run -p 5432:5432 --env-file=".db_env" -d postgres # Start the postgres db
# Prep the db, do some other stuff
# ...
docker exec -it CONTAINER_NAME psql -U postgres
Currently, I have to to docker ps to get the container name and then paste it and replace CONTAINER_NAME. The container is the only one running, so I am thinking I could easily find the container id or the container name automatically instead of using docker ps to manually retrieve it, but I don't know how. How do I do this using bash?
Thank you!
The container id is being returned from the docker run command:
CONTAINER_ID=$(docker run -p 5432:5432 --env-file=".db_env" -d postgres)
You can choose the name of your container with docker run --name CONTAINER_NAME.
https://docs.docker.com/engine/reference/run/#name---name
You can get its ID using:
docker ps -aqf "name=postgres"
If you're using Bash, you can do something like:
docker exec -it $(docker ps -aqf "name=postgres") psql -U postgres
In the end, I took use of #mrcl's answer, from which I developed a complete answer. Thank you for that #mrcl!
CONTAINER_ID=$(docker run -p 5432:5432 --env-file=".db_env" -d postgres)
# Do some other stuff
# ...
docker exec -it $CONTAINER_ID psql -U postgres

Unable to run psql command inside a postgres docker container

I have recently started using Docker. However, while I was able to run a postgres container and run a bash command "psql" inside it. Now, I am facing error in trying to do the same after sometime.
Here is what worked for me sometime back and now it does not work anymore:
docker run --rm -it postgres bash
The above command opens a bash inside the postgres container. When I type psql inside this container, it shows error:
root#3615146cf679:/# psql
psql: error: could not connect to server: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket “/var/run/postgresql/.s.PGSQL.5432”?
You need to use these commands in order:
start the container with:
$ sudo docker run --name some-postgres -e POSTGRES_PASSWORD=mysecretpassword -d postgres
enter the container with:
$ sudo docker exec -it some-postgres /bin/bash
when you entered the container, run:
$ psql -U postgres
I myself figured it out that using "bash" at the time of starting the container was causing the problem. Once we run it using:
docker run --rm postgres
Above command says that we need to provide a Password or Auth Method. Hence, we do so.
Anyone of below 3 commands can start a postgres container:
docker run --rm -e POSTGRES_PASSWORD=postgres postgres
or
docker run --rm -e POSTGRES_HOST_AUTH_METHOD=trust postgres
or
docker run --rm -e POSTGRES_HOST_AUTH_METHOD=trust -e POSTGRES_USER=postgres -e
POSTGRES_PASSWORD=postgres postgres
Then, we can execute:
docker exec -it <container_id> bash
psql -U postgres
CREATE TABLE tutorials (id int, tutorial_name text);
INSERT INTO tutorials VALUES (1, 'C++');
select * from tutorials;

Laravel docker deploy

I have a Laravel project where we integrate create container with docker.
I'm using the SSH plugin for laravel to SSH.
I'm trying to execute the follow code:
SSH::into('production')->run([
'docker run --expose '.$port.' --expose '.$rpcport.' --name '.$nodeName.' -i cimage:latest bash',
'docker start '.$nodeName,
'docker exec -i -t '.$nodeName.' mkdir /usr/local/bin/test',
]);
The node create perfect and start good.
Problem is the next commands not executing or something in the command is not good.
Can someone help me to get this solve?
It works with execute the commands separate like:
SSH::into('production')->run([
'docker run --expose '.$port.' --expose '.$rpcport.' --name '.$nodeName.' -i cimage:latest bash',
]);
SSH::into('production')->run([
'docker exec -i -t '.$nodeName.' mkdir /usr/local/bin/test',
]);

Could not find entity for dockerfile/elasticsearch

Im new to Docker and im having an issue.
Im trying to start the pblittle/docker-logstash container using this command:
sudo docker run -d -e LOGSTASH_CONFIG_URL=pathtomyconfig --link dockerfile/elasticsearch:es -p 9292:9292 -p 9200:9200 pblittle/docker-logstash
and i am getting the following error:
Error: Could not find entity for dockerfile/elasticsearch
If i do sudo docker ps is get the following:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
0021bd567d95 dockerfile/elasticsearch:latest /elasticsearch/bin/e 7 minutes ago Up 7 minutes 0.0.0.0:9200->9200/tcp, 0.0.0.0:9300->9300/tcp cranky_meitner2
e900cbb758a5 dockerfile/redis:latest redis-server /etc/re 12 hours ago Up 7 minutes 0.0.0.0:6379->6379/tcp redis
592a4f8d97f2 dockerfile/redis:latest redis-server /etc/re 12 hours ago Up 7 minutes 6379/tcp cocky_thompson4
What the devil am i doing wrong? How can i work out what is going on?
You got the value for the --link option wrong. The --link option of the docker run command takes a container name or id as value followed by : followed by an alias (which can be whatever you want).
What you did wrong with --link dockerfile/elasticsearch:es is to pass in a Docker image name instead of a docker container name/id.
Firstly you need a running container for ElasticSearch:
sudo docker run -d -p 9300:9300 --name myelasticsearch dockerfile/elasticsearch
Then you can run your logstash container linking to the container named myelasticsearch:
sudo docker run -d -e LOGSTASH_CONFIG_URL=pathtomyconfig --link myelasticsearch:es -p 9292:9292 -p 9200:9200 pblittle/docker-logstash

Resources