Could not find entity for dockerfile/elasticsearch - 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

Related

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

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 .

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;

Phlex Docker image is not reachable via http

I'm installing Phlex with Docker on my windows 10 PC.
I have run the command docker create --name=Phlex --net=host -v /g/phlex:/config -e HTTPPORT=5666 -e HTTPSPORT=5667 -e FASTCGIPORT=9000 -p 5666:80 -p 5667:443 --privileged digitalhigh/phlex
and the container is created.
When I start the container (docker start Phlex), it runs successfully.
However, when I try to connect to localhost:5666/5667 it refuses to connect. What am I doing wrong here? Phlex EXPOSES ports 80 and 443 and the only suspicious thing in the log is ip: either "to" is duplicate, or "224.0.0.0" is garbage and I have no idea what that means.
This is my full workflow I have done nothing else.
You need to use
docker run --name=Phlex -p 5666:5666 -p 5667:5667 -v /g/phlex:/config -e HTTPPORT=5666 -e HTTPSPORT=5667 -e FASTCGIPORT=9000 --privileged digitalhigh/phlex
When you use --net=host you should not be using port mappings. So no -p X:Y should be there. And when you want to do port mappings don't use --net=host
Also I looked at the image, it run nginx and fpm in the same image. So if you are testing phlex and or its not a core thing you work on, then you can use this image. Else you should build one of your own Dockerfile. This image is not one the optimized images as such

Docker container doesn't start due to CMD and ENTRYPOINT

Dockerfile
FROM ubuntu
.........................
.........................
.........................
# install magento script
ADD script.sh /
RUN chmod +x /script.sh
ENTRYPOINT ["bash", "-c"]
CMD ["/script.sh"]
Docker Build
docker build -t test/magento2:1.0.0 .
Docker Run
docker run -it -d --name docfiletest -h www.hostname.net -e BASE_URL=http://www.hostname.net/ -v /u01/docker/volumes/2.1.6:/var/www/html -p 7012:80 --net mynetwork --ip 172.18.0.14 --privileged test/magento2:1.0.0
Docker logs
[bu#bu docker]$ docker logs docfiletest
[SUCCESS]: Magento installation complete.
[SUCCESS]: Magento Admin URI: /admin
script.sh run successfully
Docker ps
[bu#bu docker]$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
5e3e593960f5 test/magento2:1.0.0 "bash -c /script.sh" 26 minutes ago Exited (0) 7 minutes ago docfiletest
It never get started.
I doubt here command -> "bash -c /script.sh" . I thought I'm missing something in CMD and ENTRYPOINT.
can anyone help me on this?

Resources