Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

333
Views
How to add custom commands in Dockerfile for sbt plugin

When I do sbt docker:publishLocal, it creates a Dockerfile automatically erasing previous content of the file.

I wanted to add custom commands to add cassandra to the container. I copy pasted the content of this file

https://github.com/docker-library/cassandra/blob/064fb4e2682bf9c1909e4cb27225fa74862c9086/3.11/Dockerfile

and tried to run above command again. But that wipes out all existing content and replace it with default content.

How can I add docker commands in Dockerfile or build.sbt?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

The sbt-docker plugin has a customization section, including one "Write from Scratch", which could be of interest:

You can simply wipe out all docker commands with

dockerCommands := Seq()

Now let’s start adding some Docker commands.

import com.typesafe.sbt.packager.docker._

dockerCommands := Seq(
  Cmd("FROM", "openjdk:8"),
  Cmd("LABEL", s"""MAINTAINER="${maintainer.value}""""),
  ExecCmd("CMD", "echo", "Hello, World from Docker")
)

You can write your custom Dockerfile that way: it will be correctly regenerated.

How am I going to add something like this:

 RUN set -x \ 
     && apt-get update && apt-get install -y --no-install-recommends ca-certificates wget && rm -rf /var/lib/apt/lists/* \ 
     && wget -O /usr/local/bin/gosu.... 

As in the example from the documentation:

ExecCmd("RUN",
    "set", "-x",
     "&&",
     "apt-get", "update", ...
),
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!