spurin / diveintoansible-lab

Dive Into Ansible Lab
843 stars 527 forks source link

Bug With running docker compose up #135

Closed Honigeintopf closed 3 days ago

Honigeintopf commented 3 days ago

Running the docker compose up gives me:

ebubekir@ebubekir-XPS-15-9500:~/diveintoansible-lab$ docker compose up [+] Running 9/0 ✔ Container docker Created 0.0s ✔ Container ubuntu2 Created 0.0s ✔ Container centos2 Created 0.0s ✔ Container centos3 Created 0.0s ✔ Container ubuntu1 Created 0.0s ✔ Container centos1 Created 0.0s ✔ Container ubuntu3 Created 0.0s ✔ Container ubuntu-c Created 0.0s ✔ Container portal Created 0.0s Attaching to centos1, centos2, centos3, docker, portal, ubuntu-c, ubuntu1, ubuntu2, ubuntu3 centos2 exited with code 255 ubuntu-c exited with code 255 ubuntu1 exited with code 255 centos1 exited with code 255 centos3 exited with code 255 ubuntu3 exited with code 255 ubuntu2 exited with code 255 portal | 2024/09/19 10:33:30 [emerg] 1#1: host not found in upstream "centos1" in /etc/nginx/conf.d/default.conf:15 portal | nginx: [emerg] host not found in upstream "centos1" in /etc/nginx/conf.d/default.conf:15 portal exited with code 1

spurin commented 3 days ago

I hope you didn't download anything from @Felipe-Rafael-Rosa - this was a malware attempt, have deleted the comment.

spurin commented 3 days ago

@Honigeintopf - Have you ever installed/run the lab environment before?

What operating system are you using and which version (if Windows, please share details of start/run/winver)

Honigeintopf commented 3 days ago

First time installing the environment. Im using Ubuntu 24.04, newest version of docker compose. Cloned it into my home directory.

ebubekir@ebubekir-XPS-15-9500:~/diveintoansible-lab$ docker compose version
Docker Compose version v2.29.2
ebubekir@ebubekir-XPS-15-9500:~/diveintoansible-lab$ pwd
/home/ebubekir/diveintoansible-lab
ebubekir@ebubekir-XPS-15-9500:~/diveintoansible-lab$ ls
ansible_home  config  DiveIntoAnsible_Cover.png  docker  docker-compose.yaml  README.md
ebubekir@ebubekir-XPS-15-9500:~/diveintoansible-lab$ 
spurin commented 3 days ago

Thanks @Honigeintopf, this is unusual. How did you setup Docker?

Also, I'm assuming your system is x64, is that correct.

spurin commented 3 days ago

We can try running the containers manually and seeing if there is an error, if you try any of the following and press return a few times, hopefully it will put you into a bash shell in the container, type exit to exit the shell and cleanup -

docker run -it --rm --privileged spurin/diveintoansible:centos /bin/bash
docker run -it --rm --privileged spurin/diveintoansible:ubuntu /bin/bash
spurin commented 3 days ago

In the interim, the Google Cloud Shell option can be used but let's work on seeing if we can resolve this. We'll try this out and failing this, I'll setup a 24.04 environment.

Honigeintopf commented 3 days ago

I can exec into them and ls. I have setup docker just basic, downloaded it from the official repo with apt.

[FAILED] Failed to start D-Bus System Message Bus. See 'systemctl status dbus-broker.service' for details. ^C [root@fc3797036a1e /]# ls afs bin boot config dev etc home lib lib64 lost+found media mnt opt proc root run sbin shared srv sys tmp usr utils var [root@fc3797036a1e

root@817f3fed86fe:/# ls bin boot config dev etc home lib lib32 lib64 libx32 media mnt opt proc root run sbin shared srv sys tmp usr utils var root@817f3fed86fe:/#

We can try running the containers manually and seeing if there is an error, if you try any of the following and press return a few times, hopefully it will put you into a bash shell in the container, type exit to exit the shell and cleanup -

docker run -it --rm --privileged spurin/diveintoansible:centos /bin/bash
docker run -it --rm --privileged spurin/diveintoansible:ubuntu /bin/bash
spurin commented 3 days ago

Okay so you can run these containers by the look of it, without them failing, the main difference will be the container mounts.

Can you run an ls -ald on ansible-home and also do a find ansible-home

Honigeintopf commented 3 days ago
ebubekir@ebubekir-XPS-15-9500:~/diveintoansible-lab$ ls
ansible_home  config  DiveIntoAnsible_Cover.png  docker-compose.yaml  README.md
ebubekir@ebubekir-XPS-15-9500:~/diveintoansible-lab$  ls -ald 
drwxrwxr-x 5 ebubekir ebubekir 4096 Sep 19 14:18 .
ebubekir@ebubekir-XPS-15-9500:~/diveintoansible-lab$ find ansible-home
find: ‘ansible-home’: No such file or directory
ebubekir@ebubekir-XPS-15-9500:~/diveintoansible-lab$ 

find is failing?

spurin commented 3 days ago

My bad this should be ansible_home

Honigeintopf commented 3 days ago
ebubekir@ebubekir-XPS-15-9500:~/diveintoansible-lab$ find ansible_home
ansible_home
ansible_home/centos2
ansible_home/centos2/ansible
ansible_home/centos2/root
find: ‘ansible_home/centos2/root’: Permission denied
ansible_home/centos1
ansible_home/centos1/ansible
ansible_home/centos1/root
find: ‘ansible_home/centos1/root’: Permission denied
ansible_home/ubuntu2
ansible_home/ubuntu2/ansible
ansible_home/ubuntu2/root
find: ‘ansible_home/ubuntu2/root’: Permission denied
ansible_home/ubuntu1
ansible_home/ubuntu1/ansible
ansible_home/ubuntu1/root
find: ‘ansible_home/ubuntu1/root’: Permission denied
ansible_home/ubuntu-c
ansible_home/ubuntu-c/ansible
ansible_home/ubuntu-c/root
find: ‘ansible_home/ubuntu-c/root’: Permission denied
ansible_home/centos3
ansible_home/centos3/ansible
ansible_home/centos3/root
find: ‘ansible_home/centos3/root’: Permission denied
ansible_home/ubuntu3
ansible_home/ubuntu3/ansible
ansible_home/ubuntu3/root
find: ‘ansible_home/ubuntu3/root’: Permission denied
ansible_home/shared
ebubekir@ebubekir-XPS-15-9500:~/diveintoansible-lab$ 
spurin commented 3 days ago

Thank you, this helps, when you say that you installed via apt, could you elaborate as this could mean a few different things and I want to make sure I'm replicating your experience.

spurin commented 3 days ago

Also, could you please run and share the output from the following -

docker run --rm alpine cat /proc/self/uid_map
Honigeintopf commented 3 days ago

I reinstalled it again, with this. Now it is working, so it was a broken docker installation.

https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository

spurin commented 3 days ago

And

docker --version

Thanks

Honigeintopf commented 3 days ago

Thank you for the help! I will close this issue.

spurin commented 3 days ago

Hey @Honigeintopf - Thank you, just for my benefit, how did you install prior to this?

Honigeintopf commented 3 days ago

Not really sure it's been a while, but it worked with every thing else I'm working on. I probably used the .deb package.

https://docs.docker.com/desktop/install/linux/ubuntu/

spurin commented 3 days ago

Super, thanks for confirming @Honigeintopf - I typically use the curl https://get.docker.com | sudo bash approach, it's quick, convenient and works well.