Tasks from the course Full Cycle 2.0 on Docker module
A simple multistage dockerfile to build an app in Go lang.
Useful commands:
# Build image
docker build -t adrianokerber/codeeducation go
# Build image seeing all logs (ex: using 'RUN ls' or similar commands)
docker build -t adrianokerber/codeeducation go --progress=plain --no-cache
# Run container
docker run adrianokerber/codeeducation
# Publish container
docker push adrianokerber/codeeducation
Imagem adrianokerber/codeeducation no DockerHub
Initialize all containers
docker-compose up -d
Initialize and build all containers
docker-compose up -d --build
Shutdown all containers
docker-compose down
Tip: use
docker-compose
ordocker compose
without dash.
Access the aplication with the browser using localhost:8080
to acess via Nginx (Reverse proxy) or localhost:3000
for direct connection to node app container.
The application has two routes: /
and /name/:yourName
where the yourName
parameter is the name for a new register on the DB.
Build Docker image locally
docker build -t adrianokerber/laravel .
Run Docker image on a container
docker run -d --name laravel -p 8000:8000 adrianokerber/laravel
Remove all Docker containers
docker rm $(docker ps -aq) -f
Interact with container using Bash (Note: <container_name> is the name of your target container)
docker exec -it <container_name> bash
Other useful commands:
# List running containers
docker ps
# List images
docker images
# Remove container
docker rm <container_id>
# Remove image
docker rmi <image_id>
-- Enter bash of container
docker exec -it db bash
-- On MySQL container run this to access and complete password as "root"
mysql -uroot -p
-- Select database
use nodedb;
-- Create table
create table people
-- Select registers from table people
select * from people;
This project uses Gitmoji as commits' pattern along with a clear message