Docker tips
This commit is contained in:
parent
15b146ecc5
commit
971be62ca7
20
docker.md
Normal file
20
docker.md
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
Show running containers
|
||||||
|
`docker ps`
|
||||||
|
|
||||||
|
Show all existing containers
|
||||||
|
`docker ps -a`
|
||||||
|
|
||||||
|
Access a container
|
||||||
|
`docker exec -it CONTAINER bash`
|
||||||
|
|
||||||
|
Remove a volume not associated with any container
|
||||||
|
`docker volume prune`
|
||||||
|
|
||||||
|
Start a container from a compose file
|
||||||
|
`docker-compose up -d`
|
||||||
|
|
||||||
|
Backup a database from a container
|
||||||
|
`docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql`
|
||||||
|
|
||||||
|
Restore a database to a container
|
||||||
|
`cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE`
|
Loading…
Reference in New Issue
Block a user