Athrill's Docker container minimization procedure

Introduction

The memo I wrote before came out, so I will write it as an article.

How to run Athrill with Docker

https://qiita.com/kanetugu2018/items/f1368a6da7bdc773cfd9

Although it is introduced in, I would like to make it as small as possible because it is a good idea. It would be interesting to be able to move several or dozens of Athrills at the same time in the garden.

This time, I would like to configure it from Docker's scratch.

Static build of Athrill

If you build athrill normally, it will use the dynamic link library, so If you try to run it in an environment with nothing in it, it will be moss.

Therefore, rebuild it statically.

Change the Makefile to something like this

/trunk/src/build/target/linux_v850e2m/Makefile


28: $(GCC) -O3 $(LFLAGS) $(AROBJS) -o $(TARGET)  $(LIBS) -static

Rebuild.

$ make clean; make

Dockerfile Create a folder for docker and statically build athrill Collect the binaries, asp and configuration files to be used, and create a Dockerfile there.

FROM scratch

COPY athrill2 .
COPY asp .
COPY memory.txt .
COPY device_config.txt .

CMD ["./athrill2", "-i", "-m", "memory.txt", "-d", "device_config.txt", "asp"]

If you notice it now, you don't need to pass the option with CMD. Just hit athrill It seems more straightforward to pass it as an argument.

Container creation

docker build -t athrill .

Run

docker container run -it athrill

Recommended Posts

Athrill's Docker container minimization procedure
Small Docker container
Docker container usage scene
CI / CD Docker container monitoring
Run React on a Docker container
Run GUI application on Docker container
Introduction to Linux Container / Docker (Part 2)
Rails on Docker environment construction procedure
Run PureScript on a Docker container
Pass environment variables to docker container
[Docker] Operation up to container creation # 2
docker single container restart for myself
[Linux] Start Apache container with Docker
Build WebRTC Janus with Docker container
About Docker, disguise server and container