spurin / diveintoansible-lab

Dive Into Ansible Lab
775 stars 494 forks source link

Problem to open on the browser #122

Open Farzan-Far opened 6 months ago

Farzan-Far commented 6 months ago

after I installed the lab and then ran the sudo docker-compose up all images were running but suddenly all the screen went to the terminal of ubuntu-1 ubuntu-2 and I can not come out of it. my os is ubuntu 22.04 I don't know what is wrong?

spurin commented 6 months ago

Hi @Farzan-Far

To clarify, are you running Ubuntu 22.04 as your Desktop OS?

Farzan-Far commented 6 months ago

Hi James, yes, my desktop OS is Ubuntu 22.04.

spurin commented 6 months ago

Thanks @Farzan-Far

I think this is where the CentOS containers running systemd may be causing interference, the quick win for now would be

a) Using the Google Cloudshell Environment b) Installing Docker Desktop

I've encountered this previously but it is difficult to recreate. If you are willing, I would like to try creating some custom images that will fix this issue for you (and then, in the future these will become the default).

Please let me know your thoughts.

Farzan-Far commented 6 months ago

I would be thankful if you could configure and solve this Issue by creating new images.

I think your course is very useful.

Farzan

spurin commented 6 months ago

Thank you so much @Farzan-Far

The images that I use are stacked images where I build upon each image to make the final. If you run the following, it should run the top level centos image and hopefully, this will replicate the issue you saw -

CONTAINER=$(docker run -d --privileged spurin/container-systemd:centos_8)
docker exec -it $CONTAINER bash

At this point you'll be in the container shell and will or will not have received the error. You can clean this up as follows once you've run exit to exit from the container

docker stop $CONTAINER
docker rm $CONTAINER
docker rmi spurin/container-systemd:centos_8

Could you please confirm for me if you see the issue when it's run like this?

Farzan-Far commented 6 months ago

Dear james, For better understanding i attchaed photos of my problem. 20231218_163436 ![Uploading 20231218_163404.jpg…]()

spurin commented 6 months ago

Thank you!

Appreciate this @Farzan-Far - And is this what you see when you run the commands that I provided?

Farzan-Far commented 6 months ago

No no. This is the output where i write the: docker-compose up

I dont understand where and when i should run Your command.

spurin commented 6 months ago

Gotcha,

The commands that I supplied, you can just run them in your terminal where you would normally just run docker-compose up

spurin commented 6 months ago

By the way @Farzan-Far - also seeing if I can spin up an equivalent vm for testing, if you can let me know how you get on or if any clarification is needed that would be great.

Farzan-Far commented 6 months ago

i run this : CONTAINER=$(docker run -d --privileged spurin/container-systemd:centos_8) docker exec -it $CONTAINER bash. after that, I was kicked out. and I must sign in again. but when i write docker-compose up, all images are running except the centos8 but again I ![Uploading Screenshot from 2023-12-18 18-11-27.png…]() am kicked out for logging in again. i send you a photo after the docker ps command.

thank you for your kind support.

spurin commented 6 months ago

Thanks so much for trying this, this confirms the centos image is causing a problem.

Can you try this variation of the command and press return a few times, thos should once again kick you out of your system -

docker run --rm -it --privileged spurin/container-systemd:centos_8 bash

If it does, can you then try this variation instead and see if it's any better -

docker run --rm -it --privileged spurin/container-systemd:centos_8_removemore bash

If the second one works you may need to type exit

Farzan-Far commented 6 months ago

as you said after running this: docker run --rm -it --privileged spurin/container-systemd:centos_8 bash. and I kicked out and then ran the last command and started downloading the new images. and it is done what is the next step??

spurin commented 6 months ago

Super! Thanks @Farzan-Far

This is great news, we know that this can be fixed. That second image, I removed a lot of items for testing purposes and one of those removals, has got around this issue.

I think I know which one but could be incorrect.

Next steps will be making some more focussed images to check the fix. Just popped out but as soon as I'm back, I'll provide the next image for testing 👍

Once we've narrowed it down, I can push out a brand new release of the lab with this included.

Farzan-Far commented 6 months ago

Thank you for your time and consideration. I eagerly await your response.

spurin commented 6 months ago

Hi @Farzan-Far

I've put together some different versions, each isolating a potential fix, hopefully one of them should run without crashing your system, could you try these and let me know if you hit a version which does not cause the crash -

docker run --rm -it --privileged spurin/container-systemd:centos_8_fix_122_1 bash
docker run --rm -it --privileged spurin/container-systemd:centos_8_fix_122_2 bash
docker run --rm -it --privileged spurin/container-systemd:centos_8_fix_122_3 bash
docker run --rm -it --privileged spurin/container-systemd:centos_8_fix_122_4 bash
docker run --rm -it --privileged spurin/container-systemd:centos_8_fix_122_5 bash
docker run --rm -it --privileged spurin/container-systemd:centos_8_fix_122_6 bash
docker run --rm -it --privileged spurin/container-systemd:centos_8_fix_122_7 bash
Farzan-Far commented 6 months ago

Absolutely my friend, tomorrow i will check and feedback to you.

Farzan-Far commented 6 months ago

Dear James, Unfortunately, none of them work. after running the command kicked me out.

spurin commented 6 months ago

what happens if you run the following -

docker run --rm -it --privileged spurin/container-systemd:centos_8_removemore bash

Thanks

spurin commented 6 months ago

Also, can you please try the following variation -

docker run --rm -it --privileged spurin/container-systemd:centos_8_fix_122_8 bash
Farzan-Far commented 6 months ago

Hi, When i Run this: docker run --rm -it --privileged spurin/container-systemd:centos_8_removemore bash like always kicked me out.

but when I Run this Command: docker run --rm -it --privileged spurin/container-systemd:centos_8_fix_122_8 bash I got this error:

Screenshot from 2023-12-20 10-58-41 Screenshot from 2023-12-20 10-58-41

spurin commented 6 months ago

Whilst we troubleshoot, I think it is best we stop and remove some of these older images.

Assuming you're only using docker for the lab purposes, can you stop all running containers with -

docker stop $(docker ps -a -q)

Then remove with -

docker rm $(docker ps -a -q)

And let's then try that one again -

docker run --rm -it --privileged spurin/container-systemd:centos_8_fix_122_8 bash

Thank you!

Farzan-Far commented 6 months ago

i already did that and in the second image, I got the error of: Welcome to CentOS Linux 8!

Set hostname to <1f31e0de4d56>. Failed to start default target: Unit systemd-logind.service is masked. [!!!!!!] Failed to start default target, freezing. Freezing execution

spurin commented 6 months ago

okay great, thanks! Let's try re-enabling systemd-logind -

docker run --rm -it --privileged spurin/container-systemd:centos_8_fix_122_9 bash
Farzan-Far commented 6 months ago

now It is Working.

Thank You so much for your support.

spurin commented 6 months ago

Amazing, okay, so we've narrowed it down to something in this last build, I will make some more focussed ones to identify which component stopped it crashing your screen. Will update shortly, appreciate all your help with this.

spurin commented 6 months ago

Any errors with this one? -

docker run --rm -it --privileged spurin/container-systemd:centos_8_fix_122_10 bash
spurin commented 6 months ago

Hi @Farzan-Far ,

Need to narrow something down, in the lab directory, if you run

docker compose down
docker compose up

Does it trigger the issue still ?

Farzan-Far commented 6 months ago

You mean in the first step I run this new command: docker run --rm -it --privileged spurin/container-systemd:centos_8_fix_122_10 bash then down and up the docker-compose?

Farzan-Far commented 6 months ago

But the point is when i was running this : docker run --rm -it --privileged spurin/container-systemd:centos_8_fix_122_8 bash my terminal window got freeze. and I opened a new terminal window and ran the docker-compose up and it worked nicely.

cw222kq commented 6 months ago

Hi James, What can I test in order to make it work properly?

Kind regard, Charlotte

spurin commented 6 months ago

Thanks @cw222kq, @Farzan-Far is also kindly helping with this and is having the same problem. Need to find a good way of recreating the issue.

If you were to run this from the command line -

docker run --rm -it --privileged spurin/container-systemd:centos_8 bash

Does it consistently cause the issue for you? (You may need to reboot to test this thoroughly)

cw222kq commented 6 months ago

This command is also taking me into the container terminal. But this time the terminal is black with only the cursor blinking. The only way for me to get out of the container is to push the on/off button on the computer.

Yes the issue is always appearing for me when I run docker-compose up.

I'm thinking about using the Google Cloudshell Environment instead. If it's a work around.

spurin commented 6 months ago

If you press return, are you in the container image and does this crash your desktop?

And for now, yes, Cloud shell is the way, if you can spare the test cycles though I'd love to get this working properly for you 👍

cw222kq commented 6 months ago

This is what's happens for me when I run the command docker run --rm -it --privileged spurin/container-systemd:centos_8 bash IMG_1095

Black screen, blinking cursor at the top right of the screen.