Answers: <p>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.</p>
  
  <p>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:</p>
  
  <pre><code>docker exec -it your_maria_db_container_id mysql -h localhost -u root -p
  </code></pre>
  
  <p>Hope this helps.</p>
  
Answers: CC BY-SA 4.0
Answers: 2020-02-29T02:53:35.977Z
Answers: Thanks it works . Now I can run mysql commands within container .
Answers: soldier
Answers: CC BY-SA 4.0
Answers: 2020-02-28T20:53:49.137Z
Answers: 2020-02-29T01:13:46.117Z
Answers: 2020-02-29T01:13:46.117Z
Answers: taleodor
Body: <p>I recently installed Docker in Ubuntu 18.04 and with that, I have downloaded the <strong>mariadb</strong> image like this</p>
  <pre><code>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
  </code></pre>
  <p>this is pretty cool method that I used to download from the official <strong>mariadb</strong> image and it's working well. What my question is that I want to use to login to the MariaDB ? when I type</p>
  <p><code>mysql -h &lt;myhost&gt; -u root -p</code></p>
  <p>MySQL or MariaDB not found on my local Ubuntu machine. What happened ? how my pc knows that I installed <strong>mariadb</strong> using docker? then I installed <strong>mysql client app</strong> then only I can use <code>mysql</code> commands on my local pc! please give me a clarification about why it happens when install using docker?</p>
  
Tags: <docker><dockerfile><images>
Title: Does Docker images works without client application
UserDisplayName: soldier
ThreadText: # Does Docker images works without client application
  
  (Asked by: username_0 on 2020-02-25)
  
  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 <myhost> -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?
  
  **Tags:** docker, dockerfile, images
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-02-28. Score: 2 | Accepted answer
  
  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.
  
  > **Comments:**
  > **username_0**: Thanks it works . Now I can run mysql commands within container .  
  
  ---
  
  