Skip to content

Instantly share code, notes, and snippets.

@potikanond
Last active August 26, 2018 15:16
Show Gist options
  • Save potikanond/0d08a0a9f2b33d4863b9d8918b03913b to your computer and use it in GitHub Desktop.
Save potikanond/0d08a0a9f2b33d4863b9d8918b03913b to your computer and use it in GitHub Desktop.
Ex2.2: Alpine linux container

Ex2.2: Alpine linux container

Start alpine linux container, use 'Ctrl+pq' to exit without stopping container

$ docker container run -it --name my_alpine alpine sh

Reattach to the running container

$ docker container attach my_alpine

Inside the container, update and upgrade package, exit container using 'Ctrl+pq'

Note: make sure that the container can resolve fqn hostname before update, e.g. $ ping www.google.com.

/# apk update

  • sample output: *
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/community/x86_64/APKINDEX.tar.gz
v3.8.0-4-gc5ede23c7e [http://dl-cdn.alpinelinux.org/alpine/v3.8/main]
v3.8.0-4-gc5ede23c7e [http://dl-cdn.alpinelinux.org/alpine/v3.8/community]
OK: 9599 distinct packages available
...

/# apk upgrade --available

  • sample output: *
Upgrading critical system libraries and apk-tools:
(1/3) Installing libressl2.7-libcrypto (2.7.4-r0)
(2/3) Installing libressl2.7-libssl (2.7.4-r0)
(3/3) Upgrading apk-tools (2.9.1-r2 -> 2.10.0-r0)
Executing busybox-1.27.2-r11.trigger
...

Stop and start the alpine container with attaching option

$ docker container stop my_alpine $ docker container start -a -i my_alpine

Remove the alpine container

$ docker container rm -f my_alpine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment