Doing a backup of your mysql container's DB can be automated just like any other task. Script below is one way to do it. You may or may not provide a parameter to the script and you'll always get the gzipped version of the backup + its sha256 checksum. Sample Use Case: use it without parameters 1~$ ./backup_db.sh …
Read MoreUsually, a docker container has a way to easily switch to root account. It can be as easy as 'su root' or even root by default when you run a shell such as 'bash' within it. However, sometimes, it's not that easy. You need to work hard for it. My issues where the following: su command won't work as it's just a symlink …
Read MoreSometimes, you may need to know which container a volume is associated with. Use this command: 1docker ps -a --filter volume=VOLUME_NAME_OR_MOUNT_POINT See https://stackoverflow.com/questions/42857575/how-to-determine-what-containers-use-the-docker-volume
Read MoreYes, there's a fully opensourced version of docker and it's called podman. It can be installed in other OS but what I'm showing is in WSL/Ubuntu. 1~$sudo apt install podman It's actually a drop-in replacement for Docker. See details in this article.
Read MoreWhen troubleshooting, you sometimes need to check the contents of a docker image. 1docker run -it <name_of_image> sh Once you're in, you can inspect specific files and its content.
Read MoreI encounter an issue where I don't have local composer installed but I need to run one. Solution is to run it on the fly from docker container: 1docker run --rm --interactive --tty --volume <directory_path_to_your_composer.json>:/app composer install
Read MoreCheck first the names of your container: 1docker ps Technically though, it's just running a shell, so run as follows: 1docker exec -it <container-name> /bin/bash In case you see this error: 1OCI runtime exec failed: exec failed: container_linux.go:349: starting container process caused "exec: …
Read More1docker logs <friendly-name|container-id> You can tail it much like tailing ordinary logs: 1docker logs -f --tail=5 <friendly-name|container-id> which means: "start tailing at current last 5 entries of the logs"
Read More