How to view docker image in localhost - docker

I'm trying to view a docker image in local host.
After running all the setup I run docker ps and get this:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
73e73358ad00 talk-example_app "./docker/php/init.sh" 17 hours ago Created 9000/tcp, 0.0.0.0:9000->3000/tcp dazzling_galois
66acb4dbebdf nginx:latest "nginx -g 'daemon of…" 17 hours ago Up 17 hours 0.0.0.0:8111->80/tcp talk-example_nginx_1
e8cf5884ad4a talk-example_app "./docker/php/init.sh" 17 hours ago Up 17 hours 9000/tcp talk-example_app_1
e34e2574db56 talk-example_redis "docker-entrypoint.s…" 17 hours ago Up 17 hours 0.0.0.0:63791->6379/tcp talk-example_redis_1
ec44ad9b1c1f mysql:5.7 "docker-entrypoint.s…" 17 hours ago Up 17 hours 33060/tcp, 0.0.0.0:33061->3306/tcp talk-example_database_1
I'm trying to run the image talk_example_app. According to the documentation from this package I was simply supposed to clone the git repo, then run a command it would work. I've tried several different docker commands that I read online and couldn't get any to work on localhost.
EDIT: Documentation here
How can achieve this?
Adding logs:
2019-09-13 17:01:27,528 INFO exited: talk-worker_01 (exit status 255; not expected)
2019-09-13 17:01:30,540 INFO spawned: 'talk-worker_02' with pid 31
2019-09-13 17:01:30,552 INFO spawned: 'talk-worker_00' with pid 32
2019-09-13 17:01:30,566 INFO spawned: 'talk-worker_01' with pid 33
2019-09-13 17:01:30,645 INFO exited: talk-worker_02 (exit status 255; not expected)
2019-09-13 17:01:30,657 INFO gave up: talk-worker_02 entered FATAL state, too many start retries too quickly
2019-09-13 17:01:30,664 INFO exited: talk-worker_00 (exit status 255; not expected)

The provided link suppose to run 4 containers.
nginx,php,db and redis
From you docker ps Nginx is missing which is listening on port 8088
run docker ps -a which will show stoped container you may see nginx there, check the logs of the Nginx why it stopped I assume the host 8088 may be occupied.
To check images run docker images and see images, for sure nginx will be exist.
you can check logs using
docker logs
or
docker compose logs nginx

Related

Why isn't this cron job restarting my docker containers?

I currently have two docker containers running with the names fe and be, which I can see with docker container list, which gives the output:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
2f342ab21447 dockerimage1/blahblah "docker-entrypoint.s…" 3 days ago Up About an hour 0.0.0.0:80->3000/tcp, :::80->3000/tcp fe
12ea03925500 dockerimage2/blahblah "docker-entrypoint.s…" 3 days ago Up About an hour 0.0.0.0:2053->3001/tcp, :::2053->3001/tcp be
When I do crontab -e I can see my cron file:
# Jobs
10 2 * * * docker container restart fe && docker container restart be && echo 'Restarting Docker Container" > /root/clogs.txt
But it doesn't ever run, I tried checking the logs in syslog with grep CRON /var/log/syslog but i only see this repeated a bunch of times:
Feb 3 04:15:01 ubuntu CRON[106860]: (CRON) info (No MTA installed, discarding output)
Feb 3 04:16:01 ubuntu CRON[106869]: (user) CMD (/var/tmp/.update-logs/./History >/dev/null 2>&1 & disown)
I can tell that the cron job didn't work, because running docker container list again I can see that the status is still about an hour ago even when it was supposed to run 3 minutes ago.

Docker save: No such image

When i run docker save nifi > nifi_backup.tar i get
Error response from daemon: No such image: nifi
When i run docker ps -a i got
$docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a8796cbf6cb1 apache/nifi:1.9.2 "../scripts/start.sh" 11 months ago Exited (0) 33 minutes ago nifi
f4ecf6ca0d16 apache/nifi "../scripts/start.sh" 12 months ago Exited (0) 12 months ago nervous_poincare
9a68c235bb3a apache/nifi "../scripts/start.sh" 12 months ago Exited (0) 12 months ago jolly_mendel
d608287fe560 superset_superset "/entrypoint.sh" 2 years ago Up 27 hours (healthy) 0.0.0.0:8088->8088/tcp, :::8088->8088/tcp superset_superset_1
fcea620b1983 postgres:10 "docker-entrypoint.s…" 2 years ago Up 27 hours 0.0.0.0:5433->5432/tcp, :::5433->5432/tcp superset_postgres_1
380782e0a024 redis:3.2 "docker-entrypoint.s…" 2 years ago Up 27 hours 0.0.0.0:6379->6379/tcp, :::6379->6379/tcp superset_redis_1
Also, i cant start nifi image
if i run docker start nifi
it try to start about a minute, but then stop silently.
And there is no logs in result.
docker events says exit code = 0:
Maybe it has some relation for unavailable saving, so i inform about it too.
How to fix No such image in such a case?
Use the command docker images to see if there is an image named nifi. If not first build that image and than execute the command:
docker save nifi > nifi_backup.tar
It should not show the error No such image: nifi if the command docker images has an image named nifi.
As per documentation here, docker save command expects an image name, not a container. You're probably looking for docker export (export docs) command to achieve what you want.
The error about starting your container could be container-specific. As it exited already a year ago, maybe data is lost and the container cannot be started again. Using command docker events&, you can start the docker event listener in the background. This way you can obtain the hex value of this very start attempt and use it to search specific logs: docker logs <startId hex>. Maybe it can tell you more details about why the container did not properly start.

Docker container unhealthy but no error in the logs

I am using the official docker-compose file of airflow to spin it up.
Some of my containers seem unhealthy:
34d8698d67e7 apache/airflow:2.0.2 "/usr/bin/dumb-init …" 31 minutes ago Up 28 minutes (unhealthy) 0.0.0.0:5555->5555/tcp, :::5555->5555/tcp, 8080/tcp airflow_flower_1
a291cf238b9f apache/airflow:2.0.2 "/usr/bin/dumb-init …" 31 minutes ago Up 29 minutes 8080/tcp airflow_airflow-init_1
fdb20e9152f3 apache/airflow:2.0.2 "/usr/bin/dumb-init …" 31 minutes ago Up 29 minutes (unhealthy) 0.0.0.0:8080->8080/tcp, :::8080->8080/tcp airflow_airflow-webserver_1
abf5a16aa846 apache/airflow:2.0.2 "/usr/bin/dumb-init …" 31 minutes ago Up 29 minutes 8080/tcp airflow_airflow-worker_1
f6dc352f407b apache/airflow:2.0.2 "/usr/bin/dumb-init …" 31 minutes ago Up 28 minutes 8080/tcp airflow_airflow-scheduler_1
12dfc71e518f redis:latest "docker-entrypoint.s…" 31 minutes ago Up 29 minutes (healthy) 0.0.0.0:6379->6379/tcp, :::6379->6379/tcp airflow_redis_1
However the logs of one of them for example do not seem very informative.
# docker logs -f fdb20e9152f3
WARNING! You should run the image with GID (Group ID) set to 0
even if you use 'airflow' user (UID=50000)
You started the image with UID=50000 and GID=50000
This is to make sure you can run the image with an arbitrary UID in the future.
See more about it in the Airflow's docker image documentation
http://airflow.apache.org/docs/docker-stack/entrypoint
BACKEND=postgresql+psycopg2
DB_HOST=my-db-endpoint
DB_PORT=5432
WARNING! You should run the image with GID (Group ID) set to 0
even if you use 'airflow' user (UID=50000)
You started the image with UID=50000 and GID=50000
This is to make sure you can run the image with an arbitrary UID in the future.
See more about it in the Airflow's docker image documentation
http://airflow.apache.org/docs/docker-stack/entrypoint
BACKEND=postgresql+psycopg2
DB_HOST=my-db-endpoint
DB_PORT=5432
Regardless of any airflow - specific issues, how can I check docker - wise what's going on?
Docker seems to be aware of a couple of containers not being healty.
edit: both failing containers have the healtcheck condition
healthcheck:
test: ["CMD", "curl", "--fail", "http://localhost:5555/"]
and
healthcheck:
test: ["CMD", "curl", "--fail", "http://localhost:8080/"]
that seems to be failing by looking into their inspect output
Failed to connect to localhost port 8080: Connection refused
but I cannot pinpoint what is causing the failure.
edit: I have tried following the instructions to start the init service first as well
# docker-compose up airflow-init
Starting airflow_redis_1 ... done
Starting airflow_airflow-init_1 ... done
Attaching to airflow_airflow-init_1
airflow-init_1 | BACKEND=postgresql+psycopg2
airflow-init_1 | DB_HOST=my-db-endpoint
airflow-init_1 | DB_PORT=5432
but it never exits, it prints the above message and that's it...
I ran into similar issue and it was docker volume causing the issue. As I was running lots of containers on my mac, there wasn;t enough disk space. I managed to fixed this issue my pruning the docker volume.
docker volume prune
This will remove any unused volume on your mac book. Before running this command please check if you got any useful data.
For docker-compose, from the entrypoint, the default value of group id is 0.
"${AIRFLOW_UID:-50000}:${AIRFLOW_GID:-0}"
Edit your docker-compose.yaml file or ad ass env.sh file in your Airflow project repository.
It does seems to be an error due to less memory allocated to docker for running this image, try to increase the resources available to docker and see the magic
I ran into similar issue and the healthchecks were "causing" this. I was running them using default container's user.
Just to give a try, I changed the healthckeck command to start using airflow user instead, as follow:
$ runuser -u airflow -- <healthckeck command>
And it solved. I'm gonna change the user whom runs docker compose up to airflow from now on.

See docker containers that are not in k8s

docker ps command give's a list of all containers running on machine.
Containers started by kubernetes, docker-compose or using docker commands.
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
4522aaa65d4b gcr.io/kube-addon-manager:v6.4-beta.1 "/opt/kube-addons.sh" 39 hours ago Up 39 hours k8s_kube-addon-manager.....
88b141f545d3 gcr.io/pause-amd64:3.0 "/pause" 39 hours ago Up 39 hours k8s_POD.....
fe39bcdf10c0 celery "/usr/local/bin/celer" 39 hours ago Up 39 hours celery_worker
I would like to see all containers that are not started by kubernetes.
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
fe39bcdf10c0 celery "/usr/local/bin/celer" 39 hours ago Up 39 hours celery_worker
it's about as simple as docker ps | grep -v 'k8s_'

dokku error: cannot find entity for app

trying to restart dokku after a server reboot. Everything I do (redis:link, dokku deploy, pushing a new version of the app from my computer..) fails with a could not find entity error message.
2014/07/16 09:02:45 Error: Could not find entity for domain_freek
I feel like it might have something to do with the docker containers or images, so I tried restarting the latest docker container for the app, but no dice. Dokku still gives me a could not find entity error.
root#domainfreek3:/home/dokku/domain_freek# docker restart `cat /home/dokku/domain_freek/CONTAINER`
b5823fa2703f
root#domainfreek3:/home/dokku/domain_freek# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b5823fa2703f dokku/domain_freek:latest /bin/bash -c '/start 6 minutes ago Up 10 seconds 5000/tcp compassionate_tesla
f6d165a32e92 2c035b41f308 /bin/bash -c '/start 27 minutes ago Up 25 minutes 5000/tcp boring_heisenberg
96c33f5458de jezdez/redis:latest /usr/bin/redis-serve 27 minutes ago Up 27 minutes 6379/tcp redis_domain_freek
f76d9f0d944b postgresql/domain_freek:latest /usr/bin/start_pgsql 24 hours ago Up 18 hours 0.0.0.0:49153->5432/tcp sick_einstein
root#domainfreek3:/home/dokku/domain_freek# dokku deploy domain_freek
-----> Checking status of PostgreSQL
Found image postgresql/domain_freek database
Checking status... ok.
2014/07/16 09:04:47 Error: Could not find entity for domain_freek
root#domainfreek3:/home/dokku/domain_freek# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f6d165a32e92 2c035b41f308 /bin/bash -c '/start 27 minutes ago Up 25 minutes 5000/tcp boring_heisenberg
96c33f5458de jezdez/redis:latest /usr/bin/redis-serve 27 minutes ago Up 27 minutes 6379/tcp redis_domain_freek
f76d9f0d944b postgresql/domain_freek:latest /usr/bin/start_pgsql 24 hours ago Up 18 hours 0.0.0.0:49153->5432/tcp sick_einstein
Any advice would be appreciated!

Resources