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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

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

1 vote
Answer accepted
Philip Hodder
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Dec 02, 2018 • edited

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. 

Like Angel Quiroz likes this

I have the same problem

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events