Skip to content

Instantly share code, notes, and snippets.

@ninjasujan
Last active August 28, 2022 06:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ninjasujan/172217e8e749a3b93d08cf209b6a4c78 to your computer and use it in GitHub Desktop.
Save ninjasujan/172217e8e749a3b93d08cf209b6a4c78 to your computer and use it in GitHub Desktop.
docker-compose gist - command and execution step
version: "3.8"
services:
web:
build: ./frontend
ports:
- 300:3000
api:
build: ./backend
ports:
- 3001:3001
environment:
MONGO_URL: mongodb://db/test
db:
build: mongo:4.0-xenial
ports:
- 27017:27017
volumes:
- data:/data/db
volumes:
data:
### Some docker util command
List all docker Image with id
> docker image ls -q
Remove all docker image
> docker image rm $(docker image ls -q)
To remove docker container use same command replace image with container
ex:
> docker container rm $(docker container ls -aq)
Build docker container image
> docker-compose build [--no-cache]
To Build and start the container
> docker-compose up
To stop all contianer
> docker-compose down
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment