Skip to content

Latest commit

 

History

History
54 lines (32 loc) · 2.14 KB

README.md

File metadata and controls

54 lines (32 loc) · 2.14 KB

Intro

This repo is a collection of notes on creating and using containers with Docker Compose and is referenced by the following two blog articles:

./mssql

Examples of mssql containers. ReadMe.

./other-dbs

Examples of some other popular db containers. ReadMe.

  • mysql
  • postgres
  • redis

./sonarqube

Example of sonarqube setup and scanning code via docker. ReadMe.

Cleanup and Teardown Examples

Managing the lifecycle of your Docker containers is an important aspect of working with containers.

down

To stop and remove the SQL server container created with docker-compose, use the following command from the directory containing your docker-compose-mssql.yml file:

docker-compose -f docker-compose-mssql.yml down

This command stops and removes the containers, networks, and the default network, but not the volumes, preserving your data. If you wish to completely remove the data and start afresh, you can manually delete the folders specified in the volumes section.

stop & start

docker-compose also provides the option to only stop the services:

docker-compose -f docker-compose-mssql.yml stop

This command stops the running containers without removing them, allowing you to start them again later with start.

docker-compose -f docker-compose-mssql.yml start

--force-recreate option

The --force-recreate flag is a useful option for ensuring that containers are freshly created to reflect the latest configurations, especially when changes are made that don't affect the image directly. It's used with the docker-compose up command, forcing docker-compose to ignore and remove existing containers and create new ones from the updated configuration or environment variables. This option is particularly useful when troubleshooting unexpected behavior by starting with a clean state.