Cheat Sheet
Docker useful commands.
Container management
Avoid container termination after executing CMD or Entrypoint
FROM nginx
COPY my-custom-script.sh /
ENTRYPOINT ["/my-custom-script.sh"]
# OR
# CMD /my-custom-script.sh...
# Run all command line arguments
exec "$@";docker run \
-tid \
-p 8080:8080 \
--name test \
my-custom-image \
/bin/bashBash TTY connect
Run container
Run docker-in-docker
Start container on boot
CLI tricks
Attach
Image management
Create image from container
Create image from Dockerfile
Create image from AWS AMI
Get your AMI snapshot ID
Create a new volume from your AMI snapshot ID
Attach your new volume to an instance
Mount your new volume
Install Docker
Create Docker image
Testing
Cleanup
References
Cleanup dangling images
Inspect
List run command used
Show mounted volumes
Last updated