DEV Community

Aashutosh Poudel
Aashutosh Poudel

Posted on

2

Docker tips: Find IP of postgres database & View logs from a running container

1. Find IP of a PostgreSQL database running as a docker container

Run docker inspect <name-of-container>.

"NetworkSettings": {
            ...
            "Networks": {
                "name_of_your_database": {
                    ...,
                    "IPAddress": "172.18.0.2",
                    ...
                },
                ...
            }
        }
    }
Enter fullscreen mode Exit fullscreen mode

Next you can use the IPAddress from above to connect to your database using pgadmin.

Reference

2. View logs from a running docker container

In order to tail logs from inside a docker container.

Run docker logs --follow <name-of-your-container>

Reference

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay