Show Menu

Docker Tools and Terms Cheat Sheet by

docker

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: CONTA­INE­R:P­ATH­_ON­_CO­NTA­INER
docker exec -it CONTAINER bash
starts a bash terminal session in the CONTAINER specified

Aliases

docke­r_b­uild
docke­r_c­ompose followed by a docke­r_b­uil­d_js
docke­r_b­uil­d_js
builds front-end components using yarn run compile
docke­r_c­ompose
installs depend­encies as defined in compo­ser.lock - does not update
docke­r_s­tart
runs all containers as defined in docke­r-c­omp­ose.yml with the default command as defined by the image
docke­rize
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
docke­r_c­ach­e_c­lear
runs Cache­Cle­arC­ommand in order to remove cached assets
docke­r_c­ach­e_f­orc­e_c­lear
rm -rf app/cache
docke­r_r­un_­sin­gle­_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
Cont­ainer
An instan­tiation of an enviro­nment created from a specific image
File­cab­inet
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
docke­r_b­uil­d/b­uil­d_j­s/c­ompose
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
docke­r_c­ach­e_c­lea­r/d­ock­er_­cac­he_­for­ce_­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
CONT­AINER ID
Interc­han­geable with NAMES - used to reference a specific container
IMAGE
Image that the container enviro­nment is running on
COMM­AND
Command(s) that the container is runs when started
CREA­TED
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 xdebu­g.r­emo­te_­con­nec­t_b­ack=0
set xdebu­g.r­emo­te_­hos­t=1­0.2­54.2­54.254
set xdebu­g.r­emo­te_­aut­ost­art=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

Download the Docker Tools and Terms Cheat Sheet

2 Pages
//media.cheatography.com/storage/thumb/achang_docker-tools-and-terms.750.jpg

PDF (recommended)

Alternative Downloads

Share This Cheat Sheet!

Like this cheat sheet? Check out our sponsors!

Readable.io is a collection of tools to make your writing better. More readable content means higher conversion rates and better reader engagement. Measure website and document readability, measure keyword density and more!

Click Here To Get Started!

 

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

          docker-compose Cheat Sheet