Docker Cheat Sheet / Survival Guide ;)


In no particular order:

  • docker run --name [CONTAINER_NAME] -d -i -t --entrypoint /apps/bin/ \
    -v /mnt/nfs/folders/input:/mnt/autofs/input \
    -v /mnt/nfs/folders/output:/mnt/autofs/output \
    -v /mnt/nfs/folders/logs:/mnt/autofs/logs \
    -v /mnt/nfs/folders/spools:/mnt/autofs/spools \
    -v /mnt/nfs/folders/configuration-A.json:/apps/config/configuration.json \
    -v /var/run/docker.sock:/var/run/docker.sock \
    -p 443:8443 -p 8001:8001 -p 10001:10001 -p 10002:10002 \
     – We download an image from the repository, mount a couple of folders and ports that THIS specific container requires.
  • docker ps – See running containers
  • docker start [CONTAINER_NAME] – Start the container
  • docker exec -it [CONTAINER_ID] bash – Enter the container that was listed under ‘docker ps’
  • sudo docker cp [CONTAINER_ID]:/apps/tomcat/logs/tomcat.log /mnt/nfs – Copy the logs file to my EC2 host in AWS. Must be done outside the container.
  • exit – Exit the container and return to EC2 host
  • docker stop[CONTAINER_NAME] – Stop the container
  • ps -ef | grep java – See what Java processes are running
  • hostname – See the hostname of the machine
  • hostname -f – See the fully qualified hostname name
  • /apps/SSH – Create a new certificate that is signed with the correct IP and matching hostname -f
  • find / -type f | grep tomcat| grep log – Find all files on the instance with the word of tomcat or log
  • find / -type f -exec grep -il "trace" {} \; – Find all files with the words “trace” in it

To find a more useful and informative guide, visit docker-cheat-sheet!

Hi, my name is Anto! I am a cloud computing hobbyist! Give me anything to do with the cloud, and I am interested. I work for a Cloud computing company by day and as a Cloud computing hobbyist by night! My projects use PHP, NodeJs, Ubuntu, MySQL and of course Amazon Web Services. Hopefully, my blog aids your cloud journey! Feel free to post a comment and share your thoughts.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.