Monday, December 21, 2020

Fun things to do with Docker

I recently got back to doing some dev work and I'm using docker. Docker is nice in that you can make build boxes and run them which can be really handy if you're developing on a mac but your code is destined for some linux variant.

One thing I found helpful today was to mount my local project so that I could run inside my Docker centos box. I did it with something like this:

$> docker run -di --mount type=bind,source="/path/to/project/folder",target=/var/opt/project"image:tag"

When run in that manner, I can have a container running that has my local project in /var/opt/project. I can edit the code and run it after shelling onto the box. Other common commands I use a lot.

$> docker ps
$> docker exec -it <id> /bin/bash
$> docker stop <id>


No comments: