Command:
docker build [OPTIONS] PATH | URL | -
Example:
Interaction mode for developmentdocker build -t papi-poc:0.3 .
Command:
docker run -it [OPTIONS] IMAGE[:TAG|@DIGEST] [COMMAND] [ARG...]
Example:
docker run -it --cap-add SYS_PTRACE -p 8081:80 -p 28081:9001 -p 18081:8008 -v /docker/queues/data:/data --name papi-poc papi-poc:0.3
Remarks:
--cap-add means, Add Linux capabilities
Detach mode for production setupSYS_PTRACE means, The ptrace() system call provides a means by which one process (the "tracer") may observe and control the execution of another process (the "tracee"), and examine and change the tracee's memory and registers. It is primarily used to implement breakpoint debugging and system call tracing. To fix some error thrown by supervisor.
Command:
docker run -d [OPTIONS] IMAGE[:TAG|@DIGEST] [COMMAND] [ARG...]
Example:
docker run -d --cap-add SYS_PTRACE --restart=always -p 8081:80 -p 28081:9001 -p 18081:8008 -v /docker/queues/data:/data --name papi-poc papi-poc:0.3
Remarks:
First, find the container ID: > docker ps--restart=always means, always restart the container regardless of the exit status. When you specify always, the Docker daemon will try to restart the container indefinitely. The container will also always start on daemon startup, regardless of the current state of the container.
Then, login to the container Command:
docker exec -i -t CONTAINER bash
Example:
Command: > docker cp [OPTIONS] CONTAINER:PATH LOCALPATH|-docker exec -i -t b9584c8a4893 bash
OR
docker cp [OPTIONS] LOCALPATH|- CONTAINER:PATH
Example:
You may need higher specification for vagrant instance, i.e. 4 cores and 2 GB RAM > docker rm $(docker ps -a | grep '2 days ago' | awk '{print $1}')docker cp papi-poc:/etc/nginx/nginx.conf /vagrant/nginx.conf
OR remove all
docker rm $(docker ps -a -q)