Last active
December 10, 2019 21:43
-
-
Save deibit/2064fd346a4da83c4059275ee5c4458d to your computer and use it in GitHub Desktop.
Docker cookbook
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
- Open an interactive session into a container | |
docker exec -it <containder_name> /bin/bash | |
(/bin/bash or whatever command you want to execute) | |
- Running a container in a specific network with a network alias (so we can reference this name in other containers): | |
docker run --name <container_name> --net <network_name> --net-alias <container_netname> -d <image> | |
- Specify a network in docker-compose file: | |
networks: | |
default: | |
external: | |
name: <network_name> | |
- Create a network: | |
docker network create <network_name> | |
- List containers: | |
docker ps | |
docker container ls | |
- List images: | |
docker images | |
docker image ls | |
- Save a container as an image: | |
docker commit <options> <image_name> | |
- Live statistics: | |
docker stats | |
- Import/export: | |
$ mongodump | |
$ mongoimport | |
$ mongorestore | |
- Copying files from a container | |
docker cp <container_name>:path_inside_container host_path |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment