Does Docker images works without client application I recently installed Docker in Ubuntu 18.04 and with that, I have downloaded the mariadb image like this
docker run --name mariadb \
-p 3306:3306 \
-v /opt/mariadb_data:/var/lib/mysql \
-e MYSQL_ROOT_PASSWORD=lopaz \
--restart always \
-d mariadb:10.1

this is pretty cool method that I used to download from the official mariadb image and it's working well. What my question is that I want to use to login to the MariaDB ? when I type
mysql -h &lt;myhost&gt; -u root -p
MySQL or MariaDB not found on my local Ubuntu machine. What happened ? how my pc knows that I installed mariadb using docker? then I installed mysql client app then only I can use mysql commands on my local pc! please give me a clarification about why it happens when install using docker?
When you download mariadb image, mysql client tool is only available inside container. It is not getting magically installed on your local - that is why you had to install mysql client app.

Alternative way to connect to db without installing mysql app is to use docker exec and through this get to mysql tool available on container. So you would do something like:

docker exec -it your_maria_db_container_id mysql -h localhost -u root -p


Hope this helps.