gefyrahq / gefyra

Blazingly-fast :rocket:, rock-solid, local application development :arrow_right: with Kubernetes.
https://gefyra.dev
Apache License 2.0
692 stars 28 forks source link

Can't get container to run #57

Closed adelholtz closed 2 years ago

adelholtz commented 2 years ago

HI there

i have been playing around with gefyra for a while now but i can't get containers to run with "gefyra run ..."

I followed the steps mentioned in "Try it yourself" and everything goes smootly until i reach the point with "gefyra run..."

$ gefyra run -i ft_nginx:latest -N trinity-node-nginx -n default
[INFO] Container image 'ft_nginx:latest, trinity-node-nginx:local' started with name 'trinity-node-nginx' in Kubernetes namespace 'default'

After that nothing.

gefyra list --containers

is empty.

docker ps

$ docker ps
CONTAINER ID   IMAGE                            COMMAND                  CREATED          STATUS          PORTS                                                                     NAMES
e3373ba4a3fd   gefyra-cargo:20220411100704      "/init"                  16 minutes ago   Up 16 minutes                                                                             gefyra-cargo
96d65530320f   ghcr.io/k3d-io/k3d-tools:5.4.1   "/app/k3d-tools noop"    9 days ago       Up 34 minutes                                                                             k3d-mycluster-tools
709f37e97c4f   ghcr.io/k3d-io/k3d-proxy:5.4.1   "/bin/sh -c nginx-pr…"   9 days ago       Up 34 minutes   0.0.0.0:31820->31820/udp, 0.0.0.0:8080->80/tcp, 0.0.0.0:53097->6443/tcp   k3d-mycluster-serverlb
4b995ccc69f5   rancher/k3s:v1.22.7-k3s1         "/bin/k3d-entrypoint…"   9 days ago       Up 34 minutes                                                                             k3d-mycluster-agent-0
940680a96177   rancher/k3s:v1.22.7-k3s1         "/bin/k3d-entrypoint…"   9 days ago       Up 34 minutes                                                                             k3d-mycluster-server-0

is not showing the container i should have just created/run.

The "try it yourself" guide says:

"Exec into the running container and look around. You will find the container to run within your Kubernetes cluster. docker exec -it mypyserver bash"

But that should only be possible unless something shows up with "docker ps" no?

Am i missing something? Did i do something wrong? Or am i just to stupid to use this tool? 😅

buschNT commented 2 years ago

Hello adelholtz!

this sounds like a similar problem I had last week. And maybe you already answered your question yourself:

But that should only be possible unless something shows up with "docker ps" no?

There should be a local container after the gefyra run ... command. This container is then bridged into the cluster using gefyra bridge .... In my case I was missing a CMD command in my Dockerfile and the container was exiting all the time.

Maybe your container does not keep running, too? You could check this directly using docker. Sometimes you might need to add something like "tail -f /dev/null" to keep the container running.

Alternatively you can follow the "Try it yourself" guide with the example project to confirm that everything works fine.

I hope this helps. Feel free to reach out again if this does not help!

adelholtz commented 2 years ago

HI

ok thank you for the answer. I figured the out what the problem was. The container did indeed not start so it is no wonder it didn't show up after "gefyra run..." It would help though to get a feedback at that point, that something may be wrong with the container we try to start at this point.

My problem in this case was, that I took one of my already existing containers, in this case an nginx container. What I forgot however was, that I had a reverse and web socket connection defined in the nginx config, and the container didn't start because the connections/servers he was trying to use did not exist.

Will have to look into that specific setup further to figure out how to deal with such scenarios.

Your answer helped me get on the right track shower, so thank you.