spring boot

Docker Cheat Sheet for Spring Developers

I’ve been playing with Docker a lot recently to deploy Spring Boot applications.  Docker is very cool. I’ve been learning a lot about it.

This is my unofficial Docker Cheat sheet. Use with caution!

Got any tips and tricks? Comment below, and I’ll try to update this.

List all Docker Images

List All Running Docker Containers

List All Docker Containers

Start a Docker Container

Stop a Docker Container

View the logs of a Running Docker Container

Delete All Docker Containers

Use -f option to nuke the running containers too.

Remove a Docker Image

Delete All Docker Images

SSH Into a Running Docker Container

Okay not technically SSH, but this will give you a bash shell in the container.

Use Docker Compose to Build Containers

Run from directory of your docker-compose.yml file.

Use Docker Compose to Start a Group of Containers

Use this command from directory of your docker-compose.yml file.

This will tell Docker to fetch the latest version of the container from the repo, and not use the local cache.

This can be problematic if you’re doing CI builds with Jenkins and pushing Docker images to another host, or using for CI testing. I was deploying a Spring Boot Web Application from Jekins, and found the docker container was not getting refreshed with the latest Spring Boot artifact.

Follow the Logs of Running Docker Containers With Docker Compose

Save a Running Docker Container as an Image

Follow the logs of one container running under Docker Compose

Dockerfile Hints for Spring Boot Developers

Add Oracle Java to an Image

For CentOS/ RHEL

Add / Run a Spring Boot Executable Jar to a Docker Image

 

Share

You May Also Like

Leave a Reply