Home  >  Q&A  >  body text

开发环境 - docker能否备份环境?

最近在学习docker,初步理解了镜像和容器的概念,但看文档和一些使用案例还是有一些地方比较迷惑。
按照docker的介绍,是可以基于基础镜像打包的,只要你有一个dockerfile就能在另外的机器上生成一模一样的环境和依赖,那我可不可以用docker来把我现在mac上的各种开发环境和工具都打到镜像里,比如webstorm,chrome,等各种命令行的或可视化ide的工具,如果这样可以的话,那不就相当于有了一个云系统了吗,我换了一台新机子,不用在重新装各种工具和环境,也不用在乎是什么系统,只要pull 这个镜像不就行了?还是说docker只能打包那些命令行形式的依赖和应用?这一块有些困惑

phpcn_u1582phpcn_u15822757 days ago823

reply all(2)I'll reply

  • ringa_lee

    ringa_lee2017-04-25 09:04:01

    Impossible. First of all, Docker is not a new technology, but a packaging and assembly of many old technologies. You can think of it as an enhanced version of chroot, and it relies heavily on the Linux kernel. Linux is the kernel + software package, while Docker is packaging. There is no software package file system, and the kernel is shared. Therefore, it is impossible to package various development environments on Mac into mirrors as mentioned by the questioner. Regarding packaging the GUI into the Docker image, it is theoretically possible, but in practice it is impossible because Docker only performs console display of standard input, standard output and standard error, and does not have the output method of the GUI graphical interface.

    reply
    0
  • 给我你的怀抱

    给我你的怀抱2017-04-25 09:04:01

    You are wrong. You should make the tools you need into a mirror image.

    Then just pull it in the required environment. Then use tools such as git to manage the code (dokcer only manages development environment tools).

    As for the GUI mentioned above, there is now a way to solve it. For relevant information, you can search for docker GUI or docker x11

    reply
    0
  • Cancelreply