Show Menu
Cheatography

Docker Tools and Terms Cheat Sheet by

Container Tools

docker ps
lists all currently running containers
docker ps -a
lists all containers (including stopped ones)
docker logs CONTAI­NER(S)
shows the output of the given contai­ner(s)
docker rm CONTAI­NER(S)
removes a contai­ner(s) - including any local data changes
docker rm -f CONTAI­NER(S)
same as
docker rm
except also force stops a contai­ner(s)
docker start CONTAI­NER(S)
attempts to start a stopped contai­ner(s)
docker stop CONTAI­NER(S)
attempts to stop a running contai­ner(s)
docker restart CONTAI­NER(S)
stops and then starts the specified contai­ner(s)
docker cp SRC DEST
copies files to/from a specific container to a local location
container location format:
CONTAI­NER­:PA­TH_­ON_­CON­TAINER
docker exec -it CONTAINER bash
starts a bash terminal session in the CONTAINER specified

Aliases

docker­_build
docker­_co­mpose
followed by a
docker­_bu­ild_js
docker­_bu­ild_js
builds front-end components using
yarn run compile
docker­_co­mpose
installs depend­encies as defined in
compos­er.lock
- does not update
docker­_start
runs all containers as defined in
docker­-co­mpo­se.yml
with the default command as defined by the image
dockerize
logs in to aws in order to pull new images
src_sync
copies source code into all running containers and makes sure container source is up to date
docker­_ca­che­_clear
runs
CacheC­lea­rCo­mmand
in order to remove cached assets
docker­_ca­che­_fo­rce­_clear
rm -rf app/cache
docker­_ru­n_s­ing­le_test TEST_F­ILE­_LO­CATION
runs a single phpUnit test file
cmd
starts a new container using the scriptbox image and starts an intera­ctive bash session
 

Terms

Image
A snapshot of a lightw­eight filesystem in order to run specific tasks
Container
An instan­tiation of an enviro­nment created from a specific image
Fileca­binet
A file mount that is shared across all containers

Troubl­esh­ooting

docker ps -a
use to see which containers are not starting if linking errors occur
docker logs CONTAINER
use to see specific logs and errors for a container to trouble shoot bad exit codes
src_sync
use if logs reveal that files cannot be found
docker­_bu­ild­/bu­ild­_js­/co­mpose
use if parame­ter­s/d­epe­nde­ncies seem to be incorrect
docker rm CONTAINER
use if a file is corrupt in a container
NOTE: DO NOT REMOVE
*_data
CONTAINERS AS THEY WILL TAKE A LONG TIME TO DOWNLOAD
docker­_ca­che­_cl­ear­/do­cke­r_c­ach­e_f­orc­e_clear
use if annota­tions or other cached assets seem to be corrup­t/not updating

Docker ps columns

NAMES
Interc­han­geable with
CONTAINER ID
- used to reference a specific container
CONTAINER ID
Interc­han­geable with
NAMES
- used to reference a specific container
IMAGE
Image that the container enviro­nment is running on
COMMAND
Command(s) that the container is runs when started
CREATED
Date when container was first created
STATUS
Current status of container - will also display exit codes
PORTS
Displays external -> internal port mapping and protocal

xdebug - docker native

sudo ifconfig lo0 alias 10.254.25­4.254
docker exec -it webserver bash
vi /etc/p­hp.d­/x­deb­ug.ini
press
i
to be able to edit, arrows to navigate
set
xdebug.re­mot­e_c­onn­ect­_back=0
set
xdebug.re­mot­e_h­ost­=10.25­4.2­54.254
set
xdebug.re­mot­e_a­uto­start=1
to save and quit from vi:
press
esc
type
:wq
press
enter
exit
to get out of the container
run
docker restart webserver
in order to have the new config values take place
 

Comments

No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets