Last active
May 6, 2020 15:04
-
-
Save conkonig/ca6060ccfb1f48e16184c2cf38a3c9fe to your computer and use it in GitHub Desktop.
Useful Docker Commands
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
# see all running docker containers | |
docker ps | |
# terminal into docker container | |
docker exec -it container-name /bin/bash | |
# allow larger transfers for container - eg to import larger sql file | |
docker exec -it container_name bash -c "echo 'max_allowed_packet = 512M' >> /etc/mysql/mysql.conf.d/mysqld.cnf" | |
docker exec -it container_name bash -c "echo 'wait_timeout = 1500' >> /etc/mysql/mysql.conf.d/mysqld.cnf" | |
# after this you must restart mysql | |
docker exec -it container_name bash -c "/etc/init.d/mysql restart" | |
# allow larger file uploads with php (only works with apache webserver) | |
docker exec -it container_name bash -c "echo 'php_value upload_max_filesize 256M' > '/var/www/html/.htaccess'" | |
# stop docker container | |
docker stop container-name | |
# stop all docker containers | |
docker stop $(docker ps -a -q) | |
# stop all docker containers starting automatically | |
docker update --restart=no $(docker ps -a -q) | |
# with auto start disabled you should be able to manually control the start and stop of containers with: | |
docker-compose up | |
docker-compose down | |
# import an sql file into your docker mysql container (inside container bash) | |
mysql -u root -p database < db_file.sql | |
# ctrl+c a process running docker compose is different from `docker-compose down` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment