This is a template project for ruby 2.6 & rails 6.0.
service | container name | role | host:port |
---|---|---|---|
app | rails6-tmp-app | Ruby & Rails | localhost:3000 |
db | rails6-tmp-mariadb | Database | localhost:3306 |
adminer | rails6-tmp-adminer | Database Management in PHP | localhost:8080 |
Move to docker directory:
cd ./docker/rails6-tmp
Create and start containers:
- Copy the gemfile needed for docker build to the docker directory.
- Execute docker-compose command.
- Remove gemfiles that are no needed.
cp ../../rails/Gemfile* .; \
docker-compose up -d; \
rm Gemfile*;
After container creation is finished, start with docker-compose up -d
only.
Execute an interactive bash shell on the app container:
docker exec -it rails6-tmp-app bash
View docker log
docker logs rails6-tmp-app
Visit http://localhost:3000/
.
Visit http://localhost:8080/
and browse database with "adminer".
The password is set in compose.yml.
This is the easiest way to verify that the database is up and running.