Relative Content

Tag Archive for dockergo

Docker multiplatform image [duplicate]

This question already has answers here: How to build docker image for multiple platforms with cross-compile? (2 answers) Closed 6 hours ago. So I’m stuck with this problem. I have – macos arm laptop where I need to build images – Dockerfile: FROM –platform=${BUILDPLATFORM} golang:1.22 AS builder WORKDIR /workspace # args ARG TARGETPLATFORM ARG TARGETOS […]

Rebuilding golang app in docker upon file change

I am building a golang backend with gin and I want to set it up as a service in docker. I want that when I make changes to the code the app should rebuild with the changes. I have tried to use 2 golang packages github.com/cespare/reflex and github.com/cortesi/modd.

Running docker compose for golang app with postgres database

I have created a Dockerfile for a golang back-end app and a docker-compose.yml where I have the the app and Postgres database as services. I can successfully build and run the Dockerfile using docker build -t command and docker run command. But when I try to run the docker-compose.yml file using docker-compose up --build command, it can’t seem to find the executable (.exe) file which should be in the working directory(WORKDIR).

Running code on the command line of the host computer from a docker container

In short, I will do something like this: I will have a running go service, and when I make a request to it, for example when I call the /trigger service, this service will perform an operation on another docker container on the same host, for example, there will be such a code:
cmd := exec.Command("docker", "exec", "-i", "mysql-container", "mysql", "-uroot", "-ppassword", "mydatabase", "-e" , "SELECT * FROM my_table")