Hi,
I’m trying to access MongoDB through the shell and I’m getting the following error:
ubuntu@ip-xx-x-xx-xxx:~/.local/share/tutor$ tutor local run mongodb bash
docker-compose -f /home/ubuntu/.local/share/tutor/env/local/docker-compose.yml -f /home/ubuntu/.local/share/tutor/env/local/docker-compose.prod.yml -f /home/ubuntu/.local/share/tutor/env/local/docker-compose.tmp.yml --project-name tutor_local run --rm mongodb bash
Starting tutor_local_mongodb-permissions_1 ... done
Creating tutor_local_mongodb_run ... done
mongodb@77de3e54beb3:/$ mongo
MongoDB shell version v4.2.17
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
2022-07-13T00:40:30.591+0000 E QUERY [js] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused :
connect@src/mongo/shell/mongo.js:353:17
@(connect):2:6
2022-07-13T00:40:30.593+0000 F - [main] exception: connect failed
2022-07-13T00:40:30.593+0000 E - [main] exiting with code 1
mongodb@77de3e54beb3:/$
I tried to check if the server is running, but I couldn’t find it
ubuntu@ip-xx-x-xx-xxx:~/.local/share/tutor$ systemctl status mongodb.service
Unit mongodb.service could not be found.
ubuntu@ip-xx-x-xx-xxx:~/.local/share/tutor$ service --status-all
[ + ] acpid
[ + ] apparmor
[ + ] apport
[ + ] chrony
[ - ] console-setup.sh
[ + ] cron
[ - ] cryptdisks
[ - ] cryptdisks-early
[ + ] dbus
[ - ] grub-common
[ - ] hwclock.sh
[ + ] irqbalance
[ - ] iscsid
[ - ] keyboard-setup.sh
[ + ] kmod
[ - ] lvm2
[ - ] lvm2-lvmpolld
[ + ] multipath-tools
[ - ] open-iscsi
[ - ] open-vm-tools
[ + ] plymouth
[ + ] plymouth-log
[ + ] procps
[ - ] rsync
[ - ] screen-cleanup
[ + ] ssh
[ + ] ubuntu-fan
[ + ] udev
[ + ] ufw
[ + ] unattended-upgrades
[ - ] uuidd
ubuntu@ip-xx-x-xx-xxx:~/.local/share/tutor$ tutor local run mongodb bash
docker-compose -f /home/ubuntu/.local/share/tutor/env/local/docker-compose.yml -f /home/ubuntu/.local/share/tutor/env/local/docker-compose.prod.yml -f /home/ubuntu/.local/share/tutor/env/local/docker-compose.tmp.yml --project-name tutor_local run --rm mongodb bash
Starting tutor_local_mongodb-permissions_1 ... done
Creating tutor_local_mongodb_run ... done
mongodb@27ac804dd3ae:/$ service --status-all
[ ? ] hwclock.sh
[ - ] procps
mongodb@27ac804dd3ae:/$
Can anyone help me with this? Thanks!