Docker: Local Databases

Just revisiting a couple Docker sandbox sites I started playing with a few months ago.

1: Can you create a local database with Docker? If so, how?
2: If answer to first question is ‘Yes’, can the local database be accessed with a third party app such as Navicat? With my current MAMP Pro set up I can easily back up my remote database at the end of each day to my local machine by dragging the tables to my local server. Can Docker be used in this way?

Yes, you can connect to the database which Docker creates using any tool of your choice, my example is MySQL Workbench, but you can get the idea which data to copy from your target settings:

1 Like

Why does my target settings look different? I don’t have a place to get database settings from?

Node.js is server type.

Because you are probably not using Docker now … or you messed up with targets and removed the docker target.
Are you using Docker for your project or no? When using Docker, it includes a database server and creates a database for you.

1 Like

I assume I am using Docker …

No it’s not Docker. It’s a simple nodejs project with a custom / own server hosting option selected.
When you create a docker project, you select docker as a hosting and then you see the deploy button.

Wow, now I’m really confused. How is my site working locally without a server?

I can’t figure out how to get that screen as in your screenshot?

Thought this was suppose to be easy :wink: :beers:

As i explained in another topic - Wappler has a built in NodeJS server, which is active when you select NodeJS server model!

My screenshot shows a project set up to use Docker Hosting and yours is not set up like that. Your project/target simply uses “custom hosting”, same as you are used to work with PHP .

I think I am going to start over. lol

If I select Docker Hosting does my remote host (when I get to that point) need to be able to use Docker Hosting? What is required other than Node.js on the remote host?

You have to alter the target Hosting from Own Server to Docker to see all the Docker stuff.

Yes.

Docker has nothing to do with Node.js support. Your hosting can support Node without the need of Docker…
If you are using Docker, you need a cloud hosting provider such as Digital Ocean, Linode etc. to deploy your Docker container to.

And here it’s explained how to upload your NodeJS site to a hosting provider which supports NodeJS:

So if I use Docker locally I can’t use my own host? That’s really bad.

Docker is a strange one Brad.

It needs 2 parts to make it work, 1 is the Docker host like Digital Ocean who hosts the container, and the second is a DNS provider who hosts your DNS and points the web traffic to the Digital Ocean Docker container

I use a hosting provider for this part as well as the mail etc.

On my bigger setups, I can use just a DNS provider who points out the web to Docker cloud hosting and points out the mail to Google for business.

2 Likes

Thanks Paul, that takes me back to my original point in other threads that using Node.js and Docker is very specialized and not very common or practical.

1: Limited to who you ‘have to’ host with. And as in your post having to have two hosting plans.
2: Can’t use Docker for local if you have to have Docker remotely. That’s even less commonly supported than Node.js on remote servers.

How can that be a good set up? I’m obviously missing something but I am trying to learn.

It’s great because you can use any custom web server and any custom database server in your container. And whatever you set up locally in your container is deployed to the remote cloud hosting. You set up your container locally and push it to cloud - same.

On your regular hosting you are using predefined, shared web and db servers. You can’t configure them as you wish. If they differ from your local setup you may get into troubles.

There are so many advantages of using docker that I don’t even know where to begin.

Just look at the docker container as a whole hosting available inside. A web server and a database server are inside. And they support what you configure them to support.

Not everyone can afford a zillion dollars a month for hosting on hosts you ‘have to’ host with. I am also required to have my host and server located in Canada.

So in conclusion there is no way I can use Node.js and Docker. I sure hope that Wappler never goes solely in that direction. :frowning:

You CAN use NodeJS without Docker, Brad! NodeJS does NOT require Docker to run, neither on your local computer, nor on the server!

I think you need to take a look at:

And

1 Like

But without Docker Hosting you can’t have a local database? I’m right back to where I started.