Docker Basics

Hacking 101

The docker-compose.yml has ‘command’ property that shows how to start the app ( could be function called in package.json ). The default port for debugging is 9229 and will be in the docker-compose.yml file or append -p 9229:9229 to the docker-run command, example:

docker run -d -p 80:3000 -p 9229:9229 node:15.0.1-alpine

Docker Commands

Shut down the API gateway and all containers

docker-compose -f ~/apps/conf/docker-compose.yml down

Start the API gateway and all containers

docker-compose -f ~/apps/conf/docker-compose.yml up

List information about running containers

docker ps

List Docker networks

docker network ls

Inspect API gateway network

docker network inspect conf_microservices

Run a command in a container

docker-compose -f ~/apps/conf/docker-compose.yml exec  

Note that the image name needs to match the name from the docker-compose.yml file.

Example – run /bin/bash in the Directus container.

docker-compose -f ~/apps/conf/docker-compose.yml exec directus /bin/bash

View log file for container

docker logs

The container name must match the name of a running container, not the image name.

Example – view log file for the running Kong container:

docker logs conf_kong_1

Stop instance of application

docker-compose down

Set global variable for application & Start instance of application

TEMPALTING_ENGINE=ejs docker-compose up

Leave a Reply

Your email address will not be published. Required fields are marked *