![]() ![]() Details on how to do this will depend on what database / service you’re using. Keep in mind, if you do this, you may want to restrict the outside world from connecting to it because 0.0.0.0 will allow connections from anywhere. If you were running a database, you would use 192.168.1.3 (in my case) as part of your connection string, and then configure your database to bind on 0.0.0.0. There you have it, you’ve successfully connected to your Docker host over your local network. # You should see this output (hit CTRL+C to stop it): # Ping your local network IP address (replace my IP address with yours). # Start the Alpine container and drop into a Shell prompt. Find Your Local Network IP Address on MacOS / Linux: It’s very likely going to be a 192.x.x.x or 10.x.x.x address. You can figure out your local network IP address by looking for the IP address that belongs to the same subnet as your router (assuming you’re using one). ![]() You can simply connect to your local network IP address. This means you could install your database / service directly on your Docker host and then connect to it from a running Docker container. I get it, you might not trust Docker well enough to run your database in a container (with a Docker volume to deal with persistence).įortunately you can easily have a container connect to any service that’s installed on your Docker host. Looking for a more updated version of this post? Check out Docker Tip #65. Updated on December 22nd, 2017 in #docker Docker Tip #35: Connect to a Database Running on Your Docker Host Once in a while you may want to connect a container to a database or service running on your Docker host. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |