Welcome to the Linux Foundation Forum!

Lab 2, Part 2: Error: No such container: mongodb

Options

First we create container with name mongo

docker container run -d --name mongo --hostname mongo -v /tmp/lab2/mongodb:/data/db mongo:5.0

And then we try to get port of that container by using wrong name

MIP=$(docker container inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' mongodb) && echo $MIP

Is it known issue? Should we fix it?

Comments

  • ChristianLacsina964
    Options

    That's correct - we will issue a correction soon. Thank you for the report.

    The command should be:

    MIP=$(docker container inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' mongo) && echo $MIP

  • mstepien
    mstepien Posts: 444
    edited March 2023
    Options

    @akay, thank you for flagging this issue. It has been corrected.

    Regards,
    Magda
    The Linux Foundation Training Team

Categories

Upcoming Training