Cloud-oriented Life

Cloud Native Technology Improves Lives

Get into the Docker VM

When using Docker Desktop for Mac and Windows | Docker - https://www.docker.com/products/docker-desktop, you’re actually using a tiny (custom) Alpine Linux running in a special xhyve VM on macOS or Windows. There’s so much cool stuff happening, you’re meant to forget it’s still running on a Linux kernel.

Read more »

Docker Compose FAQs

ImportError: No module named ‘requests.packages.urllib3’

1
2
3
4
# CentOS 7.x
$ docker-compose up
...
ImportError: No module named 'requests.packages.urllib3'

Install specific version of requests.

1
2
3
$ sudo pip install requests urllib3 pyOpenSSL --force --upgrade

$ sudo pip install --upgrade --force-reinstall 'requests==2.6.0'

References

References

[1] Microservices in Go: REST APIs (Part 4) - OpenAPI 3 and Swagger UI - https://mariocarrion.com/2021/05/02/golang-microservices-rest-api-openapi3-swagger-ui.html

[2] REST Servers in Go: Part 4 - using OpenAPI and Swagger - Eli Bendersky’s website - https://eli.thegreenplace.net/2021/rest-servers-in-go-part-4-using-openapi-and-swagger/

[3] Go, Swagger, and Open API. Documenting Go REST services with… | by Pagis | May, 2021 | Level Up Coding - https://levelup.gitconnected.com/go-swagger-and-open-api-e6b6ea4ce48f

Swagger Open API Specification 2.0 and 3.0 in Go | by Kecci Kun | Medium - https://kecci.medium.com/swagger-open-api-specification-2-0-and-3-0-in-go-c1f05b51a595

deepmap/oapi-codegen: Generate Go client and server boilerplate from OpenAPI 3 specifications - https://github.com/deepmap/oapi-codegen

getkin/kin-openapi: OpenAPI 3.0 implementation for Go (parsing, converting, validation, and more) - https://github.com/getkin/kin-openapi

go-swagger/go-swagger: Swagger 2.0 implementation for go - https://github.com/go-swagger/go-swagger

Swagger 2.0 | Primer · GitBook - https://goswagger.io/

swaggo/swag: Automatically generate RESTful API documentation with Swagger 2.0 for Go. - https://github.com/swaggo/swag

Bitnami Redis with Docker and Docker Compose

Bitnami makes it easy to get your favorite open source software up and running on any platform, including your laptop, Kubernetes and all the major clouds. In addition to popular community offerings, Bitnami, now part of VMware, provides IT organizations with an enterprise offering that is secure, compliant, continuously maintained and customizable to your organizational policies.

Redis is an open source (BSD licensed), in-memory data structure store, used as a database, cache, and message broker. Redis provides data structures such as strings, hashes, lists, sets, sorted sets with range queries, bitmaps, hyperloglogs, geospatial indexes, and streams. Redis has built-in replication, Lua scripting, LRU eviction, transactions, and different levels of on-disk persistence, and provides high availability via Redis Sentinel and automatic partitioning with Redis Cluster.

Read more »

docker history

Show the history of an image

Prerequisites

Usage

1
$ docker history [OPTIONS] IMAGE

For example uses of this command, refer to the examples section below.

Options

1
2
3
4
5
Name, shorthand	Default	Description
--format Pretty-print images using a Go template
--human , -H true Print sizes and dates in human readable format
--no-trunc Don't truncate output
--quiet , -q Only show image IDs

Examples

To see how the docker:latest image was built:

1
2
3
4
$ docker history docker
(nop) ENV LC_ALL=C.UTF-8 0 B
(nop) ADD jessie.tar.xz in / 121 MB
(nop) MAINTAINER Tianon Gravi <ad 0 B

To see how the docker:apache image was added to a container’s base image:

1
2
3
$ docker history docker:scm
(nop) ADD file:1fd8d7f9f6557cafc7 373.7 MB
(nop) MAINTAINER Lokesh Mandvekar 0 B

Format the output

The formatting option (--format) will pretty-prints history output using a Go template.

Valid placeholders for the Go template are listed below:

1
2
3
4
5
6
7
Placeholder	Description
.ID Image ID
.CreatedSince Elapsed time since the image was created if --human=true, otherwise timestamp of when image was created
.CreatedAt Timestamp of when image was created
.CreatedBy Command that was used to create the image
.Size Image disk size
.Comment Comment for image

When using the --format option, the history command will either output the data exactly as the template declares or, when using the table directive, will include column headers as well.

The following example uses a template without headers and outputs the ID and CreatedSince entries separated by a colon (:) for the busybox image:

1
2
$ docker history --format "{{.ID}}: {{.CreatedSince}}" busybox
: 4 weeks ago

References

[1] docker history | Docker Documentation - https://docs.docker.com/engine/reference/commandline/history/

[2] Empowering App Development for Developers | Docker - https://www.docker.com/

0%