简体   繁体   English

有关Docker基础的一些问题吗?

[英]Some questions on Docker basics?

I'm new to docker.Most of the tutorials on docker cover the same thing.I'm afraid I'm just ending up with piles of questions,and no answers really. 我是Docker的新手。关于Docker的大多数教程都涉及到同一件事。恐怕我只会遇到很多问题,而实际上并没有答案。 I've come here after my fair share of Googling, kindly help me out with these basic questions. 我在分享Google搜寻信息后来到了这里,请为我解答这些基本问题。

  1. When we install a docker,where it gets installed? 当我们安装Docker时,它在哪里安装? Is it in our computer in local or does it happen in cloud? 它在本地计算机中还是在云中发生?
  2. Where does containers get pulled into?I there a way I can see what is inside the container?(I'm using Ubuntu 18.04) 容器被放到哪里?我有办法看到容器里面的东西吗?(我正在使用Ubuntu 18.04)
  3. When we pull an image.Docker image or clone a repository from Git.where does this data get is stored? 当我们提取图像时,Docker图像或从Git克隆存储库。此数据在哪里存储?

Looks like you are confused after reading to many documents. 阅读许多文档后,您似乎感到困惑。 Let me try to put this in simple words. 让我尝试用简单的话来表达。 Hope this will help. 希望这会有所帮助。

When we install a docker,where it gets installed? 当我们安装Docker时,它在哪里安装? Is it in our computer in local or does it happen in cloud? 它在本地计算机中还是在云中发生?

  • We install the docker on VM be it you on-prem VM or cloud. 无论您是本地VM还是云,我们都将Docker安装在VM上。 You can install the docker on your laptop as well. 您也可以在笔记本电脑上安装docker。

Where does containers get pulled into?I there a way I can see what is inside the container?(I'm using Ubuntu 18.04) 容器被放到哪里?我有办法看到容器里面的东西吗?(我正在使用Ubuntu 18.04)

  • This question can be treated as lack of terminology awareness. 可以将这个问题视为缺乏术语意识。 We don't pull the container. 我们不拉容器。 We pull the image and run the container using that. 我们提取图像并使用该图像运行容器。

    Quick terminology summary 快速术语总结

    Container -> Containers allow you to easily package an application's code, configurations, and dependencies into a template called an image. 容器 ->容器使您可以轻松地将应用程序的代码,配置和依赖项打包到称为映像的模板中。

    Dockerfile -> Here you mention your commands or infrastructure blueprint. Dockerfile- >在这里您提到您的命令或基础架构蓝图。

    Image -> Image gets derived from Dockerfile. 图像 ->图像从Dockerfile派生。 You use image to create and run the container. 您使用图像来创建和运行容器。

    Yes, you can log inside the container. 是的,您可以在容器内登录。 Use below command 使用以下命令

    docker exec -it <container-id> /bin/bash

When we pull an image.Docker image or clone a repository from Git.where does this data get is stored? 当我们提取图像时,Docker图像或从Git克隆存储库。此数据在哪里存储?

  • You can pull the opensource image from Docker-hub 您可以从Docker-hub中提取开源映像
  • When you clone the git project which is docerized, you can look for Dockerfile in that project and create the your own image by build it. 克隆经过调配的git项目时,可以在该项目中查找Dockerfile并通过构建它来创建自己的映像。

    docker build -t <youimagenae:tag> .

  • When you build or pull the image it get store in to your local. 构建或提取图像时,它将存储在本地。

    user docker images command 用户docker images命令

Refer the below cheat-sheet for more commands to play with docker. 请参阅下面的备忘单,以了解更多可与Docker配合使用的命令。 在此处输入图片说明

  1. The docker daemon gets installed on your local machine and everything you do with the docker cli gets executed on your local machine and containers. docker守护程序已安装在本地计算机上,而使用docker cli所做的所有操作均在本地计算机和容器上执行。
  2. (not sure about the 1st part of your question). (不确定问题的第一部分)。 You can easily access your docker containers by docker exec -it <container name> /bin/bash for that you will need to have the container running. 您可以通过docker exec -it <container name> /bin/bash轻松访问Docker容器,因为您需要运行该容器。 Check running containers with docker ps 使用docker ps检查正在运行的容器
  3. (again I do not entirely understand your question) The images that you pull get stored on your local machine as well. (同样,我并不完全理解您的问题)您拉出的图像也会存储在本地计算机上。 You can see all the images present on your machine with docker images 您可以通过docker images查看计算机上存在的所有docker images

Let me know if it was helpful and if you need any futher information. 让我知道它是否有帮助以及您是否需要其他信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM