Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Building React docker image fail by unexpected EOF Edited

Building a docker image fail at a step running webpack to build the client application (React).

Any tips why this happens?

Bitbucket says: Container 'docker' exceeded memory limit.

 

react-docker-image.png

 

 

Dockerfile:

# Use an official Node runtime as a parent image
FROM node:8-alpine

# Install any needed tools
RUN apk add --no-cache --update curl ca-certificates openssl git && \
update-ca-certificates && \
addgroup -S app && \
adduser -S -g app app && \
mkdir -p /usr/src/app

# Prepare build
WORKDIR /usr/tmp
COPY . /usr/tmp

# CONSUMER KEY & SECRET must be set by environment
ENV CONSUMER_KEY=CONSUMER_KEY__
ENV CONSUMER_SECRET=CONSUMER_SECRET__

# Install deps and build the client
RUN ["npm", "install", "--no-save"]
RUN ["npm", "run", "build:client"]

# Set working directory for image
WORKDIR /usr/src/app
# Copy needed files for runtime
COPY /usr/tmp/node_modules /usr/src/app/node_modules
COPY /usr/tmp/build /usr/src/app/client
COPY ./server/ /usr/src/app/server
COPY ./package.json /usr/src/app
COPY Docker-cmd.sh /
# Set Docker-cmd executable
RUN chmod a+x /Docker-cmd.sh
# Clean up
RUN rm -fr /usr/tmp

# Set client application port
ENV PORT=80

# Make port 80 available to outside this container
EXPOSE ${PORT}

# Run /Docker-cmd.sh when the container launches
CMD [ "/Docker-cmd.sh" ]

 

bitbucket-pipeline.yml:

pipelines:
default:
- step:
name: Build Docker image
script:
- docker build -t test .
services:
- docker
caches:
- docker

 

2 answers

1 accepted

0 votes
Answer accepted

Hi Amin,

As the error message says, the Docker process has run out of memory. Do you know which instruction in the Dockerfile it fails on?

You can increase the memory of docker with the following config:

pipelines:
default:
- step:
name: Build Docker image
script:
- docker build -t test .
services:
- docker
caches:
- docker
definitions:
services:
docker:
memory: 3072

More details are listed here. https://confluence.atlassian.com/bitbucket/use-services-and-databases-in-bitbucket-pipelines-874786688.html

Thanks,

Phil

Thanks!

Still not sure why building this image is taking this much of memory!

Like # people like this

I have this same issue and I don't find a good way to debug what is happening. 

If I build the same image locally and follow the usage of resources with docker stats I can see that the MEM USAGE is never over 700 MiB. 

I have 3072  MiB assigned to docker service in the pipeline. 

Also... It appears to be completely random! Every single time this happens I just re-run the pipe and it works fine the second time. 

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

Powering DevOps with Bitbucket Server & Data Center

Hi everyone, The Cloud team recently announced 12 new DevOps features that help developers ship better code, faster   ! While we’re all excited about the new improvements to Bitbucket ...

1,922 views 0 7
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you