alpinelinux / docker-alpine

Official Alpine Linux Docker image. Win at minimalism!
MIT License
1.04k stars 261 forks source link

Background commands in alpine 3.18 differ from 3.17 #330

Closed OssianEriksson closed 7 months ago

OssianEriksson commented 1 year ago

Using alpine:3.17, the following command takes 5 seconds to run (this is what I would expect):

docker run -it alpine:3.17 sh -c "echo A
sleep 1
echo B &
sleep 4
echo C"

First, A is printed, one second later B is printed and finally 4 seconds later C is printed.

In alpine:3.18.0 and alpine:3.18.2 however, the same command takes only one second (not what I would expect):

docker run -it alpine:3.18.2 sh -c "echo A
sleep 1
echo B &
sleep 4
echo C"

First A is printed, and one second later B and C are printed together after which the container exits immediately.

Why is this, and is there a way to get the old behavior?

This behavior is causing some issues for me as I'm trying to run a loop where I sleep in-between running commands in the background, but the sleeps get ignored causing the loop to run way too fast.

Sorry if I missed any available information about this.

ncopa commented 7 months ago

this appears to be fixed in alpine:3.18.3 and newer.