How to run an init script for Docker MariaDB

The official Docker mariadb image will run all *.sh and *.sql scripts in its /docker-entrypoint-initdb.d directory automatically when it starts. Table of contents: 1. Create an init.sql 2. Run an init script for Docker MariaDB 3. Access the MariaDB running container 4. References Technologies used: Docker 24.0.5 Official Docker mariadb image (latest tag) 1. Create …

Read more

Docker – Running MariaDB as a container

This article shows how to use Docker to run MariaDB as a container. Tables of contents: 1. Run MariaDB as a container 2. Specify the MariaDB version 3. Access the running MariaDB container 4. MariaDB Persistent Storage with Volume 5. Access the MariaDB container log 6. Stop the MariaDB Container 7. Start the MariaDB Container …

Read more

How to run an init script for Docker Postgres

The official Docker postgres image will run all *.sh and *.sql scripts in its /docker-entrypoint-initdb.d directory automatically when it starts. Table of contents: 1. Create an init.sql 2. Copy init.sql to container 3. Start the Postgres container 4. Access the Postgres container 5. References Technologies used: Docker 24.0.5 Official Docker postgres image (latest) 1. Create …

Read more

What is docker –rm option

On Docker, –rm option means automatically remove the container when it exits. $ docker run –rm <container_id> Done 🙂 Please read on to understand more about –rm. 1. Remove a container On Docker, the container is an instance of an image, and we can create multiple containers from an image. If the container is exited …

Read more

How to list containers in Docker?

In Docker, we can use docker ps to show all running containers, docker ps -a to show all running and stopped containers. Here are some of the commonly used examples: Terminal # common $ docker ps // show only running containers $ docker ps -a // show all containers (running and stopped or exited) # …

Read more

Docker run but no output?

docker run a container, but it displayed nothing, no output, no error? docker ps shows no running container? Terminal $ docker run -d -p 80:8080 -p 443:8443 -t markdownhtml:1.1 8eba06d44bf236109cf65b7b93842e9c898370cac1740aa2bab557a0fc8e52b9 $ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES Solution Most of the time, the container hit an error and exited automatically. We …

Read more

Docker – exec: "bash": executable file not found in $PATH

If bash shell is not working, try sh. Terminal $ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 3d1588519433 markdownhtml:0.1 "java -jar app.jar" About an hour ago Up About an hour 0.0.0.0:80->8080/tcp gracious_haibt $ docker exec -it 3d1588519433 bash OCI runtime exec failed: exec failed: container_linux.go:349: starting container process caused "exec: \"bash\": executable …

Read more

How to stop and remove all docker containers?

In Docker, we cannot remove a running container, stop it first. Stop all running containers. Terminal $ sudo docker stop $(sudo docker ps -aq) Remove all stopped containers. Terminal $ sudo docker rm $(sudo docker ps -aq) 1. Stop Container 1.1 List all containers sudo docker ps Terminal $ sudo docker ps CONTAINER ID IMAGE …

Read more

Docker + Spring Boot examples

In this tutorial, we will show you how to Dockerize a Spring Boot web application (mvc + thymeleaf). Tested with Docker 19.03 Ubuntu 19 Java 8 or Java 11 Spring Boot 2.2.4.RELEASE Maven At the end of the article, we will create a Spring Boot MVC web application and run inside a docker container. P.S …

Read more