The size of the Docker image could quickly increase during the build time. I became more mindful of the image size when I started to deploy on Github Actions. The bigger the image size, the longer the run time and the higher the runtime cost.
This is when you should consider using a multi-stage build ๐.
(3/4) ๐๐ก๐๐ง ๐ฌ๐ก๐จ๐ฎ๐ฅ๐ ๐ฒ๐จ๐ฎ ๐ฎ๐ฌ๐ ๐ ๐ฆ๐ฎ๐ฅ๐ญ๐ข-๐ฌ๐ญ๐๐ ๐ ๐๐ฎ๐ข๐ฅ๐?
You should consider moving your build to a multi-stage build when the build-required dependencies are no longer needed after the build is completed. A classic example is when building a binary application. Also, this is effective when setting up a dockerized Python environment using a virtual environment.
Today's post is a #QGISServer update. It's been a while (12 years ๐ต) since I last posted about QGIS Server. It would be an understatement to say that things have evolved since then, not least due to the development of Docker which, Wikipedia tells me, was released 11 years ago. There have been multiple Docker images for QGIS Server provided by QGIS Community members over the years.
I could self-host the family's password managerโฆ probably don't want to do it on the home NAS. Maybe a tiny cloud server? I think it just needs Docker access, a port, and a little storage.
Today, I was again reminded that I'm not Apache admin enough to set it up correctly for #QGIS Server.
Luckily, there's a #Docker container to save the day: spin it up, put the project file in the data dir, and off you go with WMS, WFS, and wfs3 / OGC API
I surrender for today. My :ladragonera:โ #pixelfed instance just works because the docker image is still in memory. My repository is messed up, the customisations are broken and the new docker-compose.yml and .env.docker` are completely failing to load, complaining about empty environment variables that have actual values.
I can't find documentation about how to migrate from v0.11.12 to v0.11.13 when using :docker:โ #Docker. I am disappointed.
To @dansup and the rest of Pixelfed developers: What you did here is a major change released by just bumping a patch version. That confuse instance maintainers. My instance is unexpectedly screwed up.
We have talked about docker a few times in the past. Most recently, we talked about it in the context of running Ollama. For todayโs post, I wanted to talk about how to turn your code into a docker container that you can run somewhere.
What is Docker
Docker provides the ability to package and run an application in a loosely isolated environment called a container. Docker containers can be deployed to just about any machine without any compatibility issues so your software stays system agnostic, making software simpler to use, less work to develop, and easier to maintain and deploy.
Once upon a time, a web application would be run on a physical piece of hardware that is running an operating system like Linux or Windows and then virtualization became a thing. Virtual machines access the hardware of a physical machine through a hypervisor. The host machine has an operating system (Ubuntu, Windows, MacOS, etc) and a hypervisor. Each virtual machine has an operating system of its own, binaries and libraries, and the actual web app. When using containers, the host machine has an operating system and a container engine but the containers only have binaries and libraries and the actual web app (no guest OS is necessary).
A dockerfile is needed to create an image and a container is the result of running an image. Today I am going to show how to go from a basic web app to a running docker container.
A Basic Node Example
If we are going to be dockerizing a web app, we need a web app to dockerize. In yesterdayโs demo on how to pass an array as a property into a web component, we looked at three ways to turn an array into an unordered list. I figured that we could do the same with todayโs demo.
In the above Node app, we are setting const items as being an array, using <a href="https://www.w3schools.com/nodejs/met_http_createserver.asp">createServer()</a> to create a new HTTP server, and then we are setting it to listen on port 8080. If you save the file locally as app.js, assuming that you have Node installed on your machine, you can run node app.js from the terminal to start the server.
You will notice that it also includes the line EXPOSE 8080, to expose port 8080 but as you will see below, it is more for documentation purposes than anything else.
Creating a Dockerignore
If you are familiar with git, you likely know what a .gitignore file is. A .dockerignore file does something similar. A .dockerignore is a configuration file that describes files and directories that you want to exclude when building a Docker image. Usually, you put the Dockerfile in the root directory of your project, but there may be many files in the root directory that are not related to the Docker image or that you do not want to include. .dockerignore is used to specify unwanted files and not include them in the Docker image.
Building a Docker Image
Now that you have what you are dockerizing, a Dockerfile, and a .dockerignore, you can simply build by running docker build . in the terminal.
If you want to aid in maintainability a little, you can add -t [image name] to the build command. When you run docker build -t node-app . in the terminal, it looks like this โฆ
As I said above, an image becomes a container when you execute it. You can execute it by running docker run -d -p 8080:8080 6cced9894e8c where -d runs it as a daemon (a background process) and -p [port number]:[port number] tells the container what port to give it on the host machine. The 6cced9894e8c hash is the โImage IDโ value from when I ran docker images above. If you tagged the image in the above step, you can use that value instead of the hash, though.
If you run docker ps after starting the container, you can verify that it is running. Go to http://localhost:8080/ and witness the splendor (now running in a docker container).
what is a good based image for build my own container image for a #rustlang project? currently using docker.io/library/rust:slim-bookworm right now. my proj is running on rust nightly though. idk if it's gonna work.
currently waiting for the build to finish... #docker#podman
I expect the docker image would contain a GHC that stack would find and use; I am using the matching resolver for the tag (e.g.: 22.17). :blobfoxhappy:
I have an odd problem with #HomeAssistant in #Docker. In its docker container, the command wget does not resolve any domains. It just times out. Curl does resolve hosts correctly. Problem is: #HACS is using wget for updates, which then fail after a while (silently).
Other containers have a working wget, so it looks like it's homeassistant + docker in this case.
The container is (as documented) in host network mode.
How to install PHP dependencies and extensions with Docker (kinsta.com)
Docker is a popular open-source platform for developing, shipping, and running applications. It encapsulates applications and their dependencies in