-
Notifications
You must be signed in to change notification settings - Fork 9
Generate a project
In this example let's say we have an application that only needs a database and something to manually run SQL queries
The first obvious step is to go to https://okty.io/ and press "Start Here" !
Now, we need something that may manage a database.
Search for your favorite database in the list.
In this example, we'll go on with mysql
This is the must important step, you have to tell okty what you really need !
Here is the recommended configuration for this example :
Here's some explanation :
- Container ID : This is the container id and should be unique
- Mysql Port : Port to use on the host computer if you want to connect to the database outside of the application
- Local path of database folder: Folder where you want to store database files (Allows persistent data storage)
- Database name : The name of the database where application data will be stored
- Mysql user : Username used to access database
- Mysql password : Password used to access database
Once your configuration is done, save your container by hitting the "submit" button
If all we want is a database, we can export our project at this step but we're not really comfortable with mysql command lines and it would be great if we had an UI to manage data
Let's add another container to do this !
We have implemented in okty a light container to manage database through UI.
Adminer is a light container that doesn't require any configuration.
Do you remember when I told you that adminer didn't require any configuration ?
That was a lie ... You have to specify host port on which one adminer will be available
In our example, default value is fine
Our project is now ready to run ! Just export it and unzip it.
Create an empty folder somewhere on your computer and put the docker-compose file inside it.
Open a terminal and navigate to your folder.
Run : docker-compose up -d
At this point, you have a database running on your computer !
Don't you believe me ? Okay...
Open your favorite internet browser and go to : http://127.0.0.1:8081/
In order to connect to your database, you have to specify data from step 3 of this tutorial
WARNING : In this case your have to access database through the container, this means server address isn't 127.0.0.1
If you have to connect to your database from an application inside another container, database ip value is the value specified in "Container ID" of mysql
If you want to stop your database, all you have to do is run one command
docker-compose stop
And that's all ! Less than 10 steps to run a local database without polluting your computer 😄