"Docker" Docker preliminary interview with Pits

Source: Internet
Author: User
Tags docker run

Docker is a popular way to deploy recently, and the most recent projects that have been tried before have been moved to Docker, the following are some of the pits and solutions encountered.
  
 
  • Network problems because of domestic reasons, Docker pull mirrors often encounter a situation that is not connected or extremely slow. This part can be used in the domestic popular Daocloud solution, using DAO pull instead of Docker pull, if it is built on its own, you may need to use a proxy or directly in the foreign host build, and then package it back.
  • The mirrors on the time synchronization hub.docker.com, including their own build, are basically in the UTC time zone as the default time zone, which is often 8 hours less than the host hosts. What's the best solution? Mount Volumn? /etc/localtime in the Docker environment, if it's a docker command, Docker-v/etc/localtime:/etc/locaitime:ro ... What if it's docker-compose.yml? Add volumes
    Volumns:   -/etc/localtime:/etc/localtime:ro
  • EntryPoint and run to build a Docker image, the last sentence is often written on the "portal" of Docker, using EntryPoint or run? What is the basic difference between the two? EntryPoint contains the command itself, which is an applied docker image, if specified? docker-a's entrypoint bit LS is the result of the ls-l of the Docker run EntryPoint?-l? , and if you specify run as LS, then? Docker run EntryPoint? ls-l? The result is ls-l, so a single execution does not require a project to run in the background, it is generally recommended to specify as entrypoint, otherwise it is recommended to run. You can use--entrypoint to overwrite the settings in the Dockerfile after Docker/docker-compose run, but you might want to use BASH-C instead if you want to do bash.
  • Space occupancy If you pull a large number of images, it can cause the Docker image to occupy a lot of disk space, so many people tend to look for small, beautiful images, but this is often not necessary: Docker will reuse the same layer, So pull or build image, it is best to find a mirror based on the same base, especially when building, can be reused as much as possible.
  • When you try Docker in the early stages of Docker, if you do not anticipate a good resource usage, you may cause Docker to die, which may cause the system to respond slowly to other services. Recommended on multicore machines (>4), CPU throttling for Docker, using Cpuset to limit n-1 cores for Docker use, one response to other operations, or using Cpu-shares to limit usage (no more than 90%)
  • Ports and Ipdocker use NAT by default as a network usage, exposing internal service ports using expose and publish bind. If you do not need to provide services, minimize host port binding, when using Docker-compose, the internal service does not need to specify the port with ports, unless it needs to be used on another machine. If you need to bind a static IP or directly use an external IP, you can use iptables, or IP netns, I did not do too much practice, the next supplement.
  • Not yet ready to add:


Article Source: http://blog.xujif.com/archives/dockers.html

"Docker" Docker preliminary interview with Pits

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.