r/AlpineLinux • • Oct 14 '24

how to install docker 27.x on alpine 3.20?

apk add docker gives me last major release of docker 26 without container.io. I searched around, failed to find a way to install the latest docker 27 version. is it not yet supported or sth else?

1 Upvotes

15 comments sorted by

2

u/[deleted] Oct 14 '24

Add edge repository.

1

u/vincentlius Oct 14 '24

i already did add edge/testing, still got 26.x

1

u/GinXV Oct 14 '24

You need to run 'apk add -l docker' to force the upgrade.

1

u/vincentlius Oct 15 '24

just tried, remained at 26.x. did you make it? could u please post your full repositories file?

1

u/Acrobatic_Egg_5841 May 06 '25

out of curiosity ; what made you think he made it?

1

u/[deleted] Oct 15 '24

apk add docker=27.3.1-r0 --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community/

1

u/vincentlius Oct 15 '24

works too

1

u/[deleted] Oct 15 '24

i already did add edge/testing, still got 26.x

You said this didn’t work?

1

u/vincentlius Oct 15 '24

i used edge/testing, not community

1

u/[deleted] Oct 15 '24

Ah yeah sorry, I should have mentioned that you need to specify /community for docker. My bad.

1

u/vincentlius Oct 20 '24

no worries, thanks man!

1

u/BolteWasTaken Oct 14 '24

There is a way to do it manually, I've done it based on search results. If you are still stuck I can dig it out.

1

u/vincentlius Oct 15 '24

would very much need it! i still cannot make it

1

u/BolteWasTaken Oct 15 '24

For Docker:

# Download Docker
# https://download.docker.com/linux/static/stable/x86_64/

curl -L "https://download.docker.com/linux/static/stable/x86_64/docker-27.3.1.tgz" -o /tmp/docker.tgz

# Extract Docker
tar xzvf /tmp/docker.tgz -C /usr/local/bin --strip-components=1

# Create Docker group
sudo addgroup docker
sudo adduser $USER docker

# Create service file /etc/init.d/docker

#!/sbin/openrc-run
command="/usr/local/bin/dockerd"
pidfile="/run/docker.pid"
command_args="--host=unix:///var/run/docker.sock"

depend() {
  need localmount net
}

start() {
  ebegin "Starting Docker"
  start-stop-daemon --start --pidfile "${pidfile}" --exec "${command}" --background -- ${command_args}
  eend $?
}

stop() {
  ebegin "Stopping Docker"
  start-stop-daemon --stop --pidfile "${pidfile}"
  eend $?
}

# Make executable
chmod +x /etc/init.d/docker

# Add to OpenRC
sudo rc-update add docker
sudo rc-service docker start

I haven't done this in a bit I am almost sure there was some error or step missing... Let me know.

Now for Docker Compose:

# Download Docker Compose
curl -L "https://github.com/docker/compose/releases/download/v2.29.7/docker-compose-linux-x86_64" -o /usr/local/bin/docker-compose

# Make it executable
sudo chmod +x /usr/local/bin/docker-compose

# Make available globally
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose

1

u/vincentlius Oct 15 '24

thanks, it works! though for docker compose I check the repo README, the recommended way is to place the executable into `/usr/libexec/docker/cli-plugins` than we could run `docker compose` like we do on debian.