How to set up docker compose for local development in a container (using Neovim)

Опубликовано: 04 Март 2025
на канале: DevOps Toolbox
15,738
285

Working locally to build applications is beyond convenience, it's a necessity. Especially if your building for Kubernetes!
The loved IDE (hopefully Neovim 😉), local packages, environment variables and configurations are all there.
But what happens when things change? Context is switched?
What happens when we deploy the application - how can we ensure that if it's "running on my machine", it would keep doing so in production?

There are more than one solutions, this time I'm focusing on docker and specifically compose, that with a few tweaks, lets you run the process in a container, while working directly from your IDE!
The secret sauce here, is mounting the local workspace to the container, and running it in an isolated environment!

SUPPORT THIS CHANNEL
https://www.buymeacoffee.com/omerxx

My Favourite Gear!
=======================================
If you enjoy my content, using the links below can help me with a small commission, thank you!
⌨️ My keyboard is the wonderful HHKB: https://amzn.to/3HwJG60
🔗 The HHKB is wired with a high quality coiled cable: https://amzn.to/3DCA87d
⌨️ Backup keyboard (for traveling mainly) - Nuphy Air60: https://amzn.to/3R3M7jz
🖥️ My ultra wide 49" monitor: https://amzn.to/3JbVThC
🎙️ Microphone - HyperX Quadcast: https://amzn.to/3kLcNJR
🦾 Heavy Duty Monitor Arm: https://amzn.to/3kKp7tS
🖱️ Mouse - MX Master 3: https://amzn.to/3DiZmaj

00:00 Intro
00:31 Example Golang application
00:46 Testing local communication with another container
01:06 Writing a compose file!
02:36 Testing the app with docker-compose
03:00 Debugging issues that can come up
04:42 Running in "detached mode" for an improved workflow
05:12 How changes in my local IDE reflect in the container!

========================

▶ Source code: https://github.com/omerxx/devops-tool...
▶ My dotfiles: https://github.com/omerxx/dotfiles
▶ Docker compose docs: https://docs.docker.com/compose
▶ Apps used: Neovim 0.8, iTerm2, Tmux
▶ KB: HHKB Professional 2

My blog: https://omerxx.com
And dev tools Telegram channel: https://t.me/espressops
Subscribe for more videos like this: https://www.youtube.com/@devopstoolbo...
Feel free to share your feedback!

#docker #container #kubernetes #learndevops #k8s #neovim #terminal #system #engineering #dev #devops #ops #cloud #asmr #asmrsounds #software