当前位置: 动力学知识库 > 问答 > 编程问答 >

ruby - Docker out of space when running bundle install

问题描述:

I'm trying to build an image for my app, FROM ruby:2.2.1, my app folder sums up about 200 mb compressed.

I'm receiving a "Your disk is full" when running bundle install. It's also takes too much time to create the compressed context. However runing a df on /var/ shows more than 1TB available, this however is not what bother me.

My question is, can I ignore everything using an * in .dockerignore and then add my root project folder as a volume using docker-compose? does this sounds like a good idea?

I've also think in:

  • Move the Dockerfile to a subfolder (but I think i'm not able to add a parent folder as volume using docker compose
  • Do a git clone in the Dockerfile, but as I already have the files on my computer this sounds like a dumb step.
  • Should I just figure out how to add more disk space to the docker container? But I still dont like the time that it takes to create the context.

网友答案:

Note, your question doesn't match your title or first half of your post, I'll answer what you've asked.

My question is, can I ignore everything using an * in .dockerignore and then add my root project folder as a volume using docker-compose? does this sounds like a good idea?

You can add your project with a volume in docker-compose, but you lose much of the portability (your image will be incomplete if anyone else tries to use it without your volume data). You also lose the ability to do any compilation steps and may increase your container startup time as it pulls in dependencies. Lastly, if you run out of space on build, there's a good chance you'll run out of space on a run unless your volume data is a significant portion of your container size.

If I ignore a file on .dockerignore can I use COPY on that file from Dockerfile?

No, you can't use COPY or ADD on any file that's excluded in the push to the docker daemon via .dockerignore.

分享给朋友:
您可能感兴趣的文章:
随机阅读: