Last active
August 28, 2022 06:44
-
-
Save ninjasujan/172217e8e749a3b93d08cf209b6a4c78 to your computer and use it in GitHub Desktop.
docker-compose gist - command and execution step
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### 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) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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