Docker build state

I have an existential question about docker. Given this dockerfile:

FROM someImage
ENV something=somehow
RUN sh
ENV somethingElse=somehow2

“Calculate Pi” is a “continuous” program that never ends and needs to be ran on the background. It calculates all the digits of PI (3.1415…..) and save it to a txt file.

  • Docker NLTK Download
  • adding R package for installation from Github in Dockerfile
  • /home/web/.gem/ruby/2.2.0/gems/redis-3.2.1/lib/redis/connection/ruby.rb:152:in `getaddrinfo': getaddrinfo: Name or service not known (SocketError)
  • How to push to AWS EC2 Service Container from a specific git branch (ie 'staging')
  • Docker Machine to a remote server
  • Docker Ubuntu Behind Proxy
  • My question:

    1. Is this dockerfile even plausible?
    2. If Yes, When I run a container based on this image, what is the saved state? In other words, if I open the txt file, what would I see?

  • Docker to store an application(service) logs in a folder and purge them on a timely basis
  • Build .NET Core Console Application into Docker
  • How to easily install and uninstall docker on MacOs
  • Node C++ extension loading in docker only Segfault on Google Compute Engine
  • Docker does not release port inside container when tomcat service is stopped
  • Unable to push docker image to Openshift Origin Docker registry
  • 3 Solutions collect form web for “Docker build state”

    When Docker builds an image, each instruction in the Dockerfile gets executed in an interim container, run from the preceding image layer. So if your ran endlessly then your image would never build – it would stick at the RUN instruction waiting for it to complete.

    In practice, it’s more likely that you’ll max out disk or CPU resource and take down the machine if you tried to build it. Either way, you wouldn’t get a completed image that you could run.

    No, that Dockerfile won’t work. RUN instructions need to complete before Docker can create an image from them. Perhaps you want to make that a CMD instruction instead?

    May be you can write your docker file like this:

    FROM someImage
    ENV something=somehow
    ENV somethingElse=somehow2
    ENTRYPOINT ["/bin/bash"]
    CMD [""]

    Then when you run this image

    docker run -d thisImage

    The script will run in your container as an App.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.