No video

037 Develop Software Inside a Docker Container

  Рет қаралды 10,872

Dan Gitschooldude

Dan Gitschooldude

Күн бұрын

In today's video I show you how to do software development inside a Docker container. This includes passing your username into the 'docker build' command and supplying various mount and environment options to the 'docker run' command so that your home directory appears inside the container. With this technique you can modify, build, and run your code inside or outside the container letting you test the exact same way your Gitlab-CI configuration tests.
My hello world project can be found at gitlab.com/git...
If you are looking for an effective concise introduction to Git, I highly recommend my "Fundamentals of Git" course on Udemy: www.udemy.com/...
If you or your company is interested in live virtual software and tools training, see www.continuous... for a list of training topics we offer.

Пікірлер: 18
@avimehenwal
@avimehenwal 5 жыл бұрын
X11 forwarding from docker is just so cooolll.
@alnoda3338
@alnoda3338 3 жыл бұрын
I found it very convenient to use docker as development environment, and install multiple software same way I do it on my local machine. Yes, there are lots of limitations compared to local environment. But the benefit of isolating everything related to the specific project in one docker image far outweighs limitations of developing directly inside the docker container. Of course, you would not need this if you are working on one project, one language, one repo, one cloud, one k8s cluster and one environment. But having 2+ projects, repos, clouds, environments etc. makes it inconvenient to switch between them. You need several actions to switch from one environment to another: switch AWS profile, switch between k8s clusters, node/python/ruby environments and so on. When I started developing in docker, switching workspaces is simply docker start/stop... Moving workspaces between laptops is as trivial as commit new image, push to private registry and pull on another machine. I have changed laptop and had all my development environments pulled as docker images same day, no single day lost. I've made public docker image alnoda/ubuntu-workspace with some niceties like zsh, cron, docker in docker, supervisord, nano, vim, git and some stuff set up.
@goldfishbrainjohn2462
@goldfishbrainjohn2462 2 жыл бұрын
Thanks for sharing.
@kotobotov
@kotobotov 5 жыл бұрын
awersome video, thanx Dan
@martyor
@martyor 2 жыл бұрын
Are all changes to the container reflected automatically with the host?
@DanGitschooldude
@DanGitschooldude 2 жыл бұрын
Yes, the changes to files are reflected automatically on the host, since it's just mounting host directories in the container. Other changes to the container however are ephemeral and will go away when the container is destroyed.
@AlanDampog
@AlanDampog 5 жыл бұрын
neat!
@FrankGraffagnino
@FrankGraffagnino 5 жыл бұрын
sweet!
@VanyaYani
@VanyaYani 5 жыл бұрын
I don't see any advantages in running editors, git, etc inside a container on Linux host. Code editor is such a personal thing, there's no way you could agree on which editors should be added to container. The only advantage I see is that there's performance issue in Docker for Mac. But you can't run gvim there. Also, in Mac it's difficult to work with passphrase protected ssh keys, but this approach doesn't solve it.
@DanGitschooldude
@DanGitschooldude 5 жыл бұрын
Yeah Mac is an entirely different beast. I agree it's almost always better to code on the host.
@DarrylHebbes
@DarrylHebbes 11 ай бұрын
Try debugging a linux Image server issue on a Windows, without Docker, and using diagnostic tools native to unix
@0x007A
@0x007A 2 жыл бұрын
When I use Docker containers for development I prefer to build single process containers and invoke them via a shell script named the same as the application running in the container via ENTRYPOINT and mounting an internal volume mapped to the current directory om the host. This makes the containerized application, in this case a development tool such as Python, appear to be natively installed on the host. For example, Python, pip, pipenv, and pylint are separate containers but are invoked by the name just as if I installed the actual software on the host computer. Using ENTRYPOINT instead of CMD as the last instruction in the Dockerfile to launch the application inside in container prevents users from modifying the container internals. I realize ENTRYPOINT can be overridden by another ENTRYPOINT with the docker run command so it is not 100% secure either but most users would be unaware of the shell script containing the docker run command.
@DanGitschooldude
@DanGitschooldude 2 жыл бұрын
Super interesting idea, thanks for sharing!
@kjn5991
@kjn5991 3 жыл бұрын
Dont install too much stuff into your images. They are supposed to be lightweight so instead of installing all the software inside the image, do the work outside the image or use a pre-made image for the software if there is one.
@DanGitschooldude
@DanGitschooldude 3 жыл бұрын
Agreed!
@alnoda3338
@alnoda3338 3 жыл бұрын
Production images should be lightweight. There is no reason to keep development images lightweight just "out of the principle", if you use those images for writing code.
038 Gitlab Merge Request Merge Methods
8:29
Dan Gitschooldude
Рет қаралды 12 М.
If you're not developing with this, you're wasting your time
14:30
Articulated Robotics
Рет қаралды 283 М.
ROLLING DOWN
00:20
Natan por Aí
Рет қаралды 10 МЛН
天使救了路飞!#天使#小丑#路飞#家庭
00:35
家庭搞笑日记
Рет қаралды 88 МЛН
Prank vs Prank #shorts
00:28
Mr DegrEE
Рет қаралды 8 МЛН
100+ Docker Concepts you Need to Know
8:28
Fireship
Рет қаралды 922 М.
My Favorite Way To Handle Dev Environments | VS Code Devcontainers
30:05
How to create a great dev environment with Docker
29:55
Patrick Loeber
Рет қаралды 260 М.
How To Use Docker To Make Local Development A Breeze
21:53
ArjanCodes
Рет қаралды 309 М.
028 Introduction to Gitlab CI
20:43
Dan Gitschooldude
Рет қаралды 46 М.
Socially isolating my Emacs with Docker!
18:24
Matheus Augusto da Silva
Рет қаралды 4,9 М.
032 Introduction to Git Subtrees
20:43
Dan Gitschooldude
Рет қаралды 39 М.
Create a Development Environment with Docker Compose by Mark Ranallo
21:05
ROLLING DOWN
00:20
Natan por Aí
Рет қаралды 10 МЛН