Setting Up Our Database
In this project, we will need a local database to test our javascript application against. To do this, we will use docker to run a Postgres server in a container.
- Watch 📺 Docker in 5 minutes
Installing Docker
:exclamation: It's likely you've followed a lot of these steps in a previous project. We've replicated them here just in case you are coming back to this track after some time, or are on a different computer than when you first did this.
Feel free to skip steps like installing Docker or MySQL-Workbench if you have already done them.
Ubuntu
Update your software database:
Remove any old versions of docker that might be on your system:
Install docker:
Check docker version:
Windows and Mac
Docker can be easily installed on Windows and Mac with Docker Desktop.
You will need to make sure Docker Desktop is running in order to use docker commands in your terminal.
You can check that your docker installation is working with:
If successful you should see something like:
Creating the Database Container
Once you have docker installed, you can pull and run a postgres image with:
Install pgAdmin4
For this challenge we will be using pgAdmin4. Regardless of your operating system, you should be able to download the client from or find instructions to do so from https://www.pgadmin.org/download/.
If you're a Linux user you may install the client by running the following commands from the official guide:
Finally
When you run pgAdmin, You should see a Add New Server
button. Click it and use the following credentials to connect:
- Hostname/address:
localhost
- User:
postgres
- Password:
password
You will also give your server a name. Something like local-postgres
will do.
When you are able to connect to your postgres container, you are ready to move on.
If the instructions above don't work, after double checking the instructions, reach out for help :)