Comments (5)
I'm not sure this is a multiline issue. I was trying YAML multiline options from: https://yaml-multiline.info/
When I tried using a single-line, single-quoted string, I still had the same complaint:
run:
run:
container: build-env
command: './gradlew assemble && java -jar build/libs/docker-java11-0.0.1-SNAPSHOT.jar'
from batect.
Ah, I get it now. Trying echo $0 $SHELL $-
reveals that this is not passed to /bin/sh
as I had expected. And recognizing the batect.yml
file is for Docker Compose, I checked the docs on command
. Those docs are not explicit, but I infer that the value of the command
line in YAML is passed to the exec()
call, so does not invoke /bin/sh
.
The complaint about "task" comes from Gradle, not Batect.
This works, if annoying in it's verbosity:
run:
run:
container: build-env
command: '/bin/sh -c "./gradlew assemble && java -jar build/libs/docker-java11-0.0.1-SNAPSHOT.jar"'
A little more nicely:
run:
run:
container: build-env
command: >-
/bin/sh -c './gradlew assemble
&& java -jar build/libs/docker-java11-0.0.1-SNAPSHOT.jar'
(Note: Do not indent further at "&&"; this changes the parsing somehow.)
from batect.
@charleskorn I'm ok with closing this. Contra, it could be a documentation request. Since Docker Compose itself doesn't explain this well, I'm uncertain if Batect should, though it is a gotcha for the unaware.
from batect.
Thanks for the feedback @binkley.
What you're seeing is the behaviour of ENTRYPOINT
and CMD
from Docker (see https://docs.docker.com/engine/reference/builder/#cmd) - I'm guessing the image you're using doesn't have an entrypoint set, and so the command
you give is executed directly, rather than being interpreted by a shell (which would handle the &&
in the way you expect).
If you wanted to remove the need to use /bin/sh -c '...'
, you could set your entrypoint (in your Dockerfile) to execute sh
. For example, add this to your Dockerfile:
ENTRYPOINT ["/bin/sh", "-c"]
(There's more explanation of this in the docs I linked to above.)
I think it's worthwhile adding some docs around this, as it's a common point of confusion - so thanks for the suggestion.
As a further aside, batect does not use Docker Compose internally - while similar, they are independent.
from batect.
I've updated the docs with a note about this - thanks again for the feedback @binkley!
from batect.
Related Issues (20)
- Provide support for Docker outside of Docker while using run_as_current_user HOT 9
- Some key events (e.g. arrows) ignored in shell inside a container, starting with batect 0.80.0 HOT 4
- Concurrent builds using bundles can intermittently fail HOT 5
- Mapping multiple host ports to single container port HOT 3
- Batect Cannot detect if a container is already running on another task HOT 5
- "Invalid cross-device link" error when attempting to list or run tasks HOT 1
- Unable to mount docker socket when running has current user on a Mac HOT 8
- Batect Pre 0.80.0 compatibility with newer versions of Docker on Windows. HOT 1
- "Fake" a proxy environment HOT 2
- Release 0.83.5 is missing assets, making RenovateBot fail HOT 3
- Version 0.83.5 fails on Apple M1 chip HOT 3
- Support running multiple task with one CLI call HOT 5
- Support for a container ID file listing the IDs of a tasks running containers HOT 8
- Add an option to just build the images needed for given tasks HOT 3
- Image build progress receiver throws exception intermittently. HOT 1
- Version 0.83+ Fails on Amazon Linux 2 due to incompatible version of GLIBC HOT 1
- Version 0.83.8 fails on Apple M1 chip HOT 5
- sudo account validation failure when run_as_current_user enabled HOT 1
- Gradle housekeeping
- Can not connect to database HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from batect.