How Docker containers Set usage time

Source: Internet
Author: User

Scene

  • A 1-hour Docker container is available for external service, and containers are destroyed when the time is up.

  • The files in a directory are packaged in tar before being destroyed and saved to the specified directory on the host machine.

Problem

1, what is the plan for you to take the timing?
2, problem two how to do technical realization?

首先不管对错,感谢每一位回答者

Reply content:

Scene

  • A 1-hour Docker container is available for external service, and containers are destroyed when the time is up.

  • The files in a directory are packaged in tar before being destroyed and saved to the specified directory on the host machine.

Problem

1, what is the plan for you to take the timing?
2, problem two how to do technical realization?

首先不管对错,感谢每一位回答者

Question 1:

When started, for example: docker-compose run --rm app
Then run a scheduled task on the host to stop:* 1 1 1 1 docker-compose stop app

Question 2:

will be docker-compose stop app written into the script
Before this, write the packaged command, if you first use a local directory as a volume of the container, so that the packaged files are on the host

  • Related Article

    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.