DEV Community

Discussion on: Stop using virtualenv, pyenv, nvm, goenv and Use Docker images

Collapse
yoursunny profile image
Junxiao Shi

Docker is great for production deployment but painful for development.

  • There's no incremental builds (rebuild changed files only). Docker has to rebuild the whole "layer".
  • There's no GDB debugger.
  • If you need a database, it has to run as another container.
  • IPv6 doesn't work well.
  • Docker cannot access certain hardware devices such as the serial port and CSI camera.
Collapse
190245 profile image
Dave

Our entire development environment runs in Docker. To address your points.

  • That's Dockerfile design, better organisation & forethought into image content might help you.
  • Yes there is, run your containers with SYS_PTRACE etc.
  • That's not a negative, but also, nothing about Docker prevents you running a DB somewhere else, or indeed, within the application container at the same time.
  • We use IPv6 without issue.
  • Yep, it can, mostly what you're seeing is an OS problem. Run Linux, install docker, and mount /dev (with the proper kernel options) into the container.
Collapse
darkain profile image
Vincent Milum Jr

I'd suggest checking out FreeBSD with Jails then. They are the containerization system that Linux modeled after (but IMO didn't do it anywhere near as well). Jails are functionally containers, but from a UX perspective are closer to full blown virtual machines. You can SSH into them, local console access into them, they have the full FreeBSD package manager, can install and run virtually anything that could run on the host. They also have their own independent network stack via VNET, which fully supports DHCP, IPv6, the whole array of networking protocols, or optionally share the host's networking stack instead. Additionally, you get native ZFS support accessible on the host, and optionally accessible inside the jail for each snapshotting/backup/replication/deployment.

Collapse
javidjms profile image
Javid Mougamadou Author

You don't have to necessary need another container for your database.
You could also have it directly installed on your OS.

In my case, I prefer to containerised all of my stack (db, api, app, broker, etc,)

Collapse
nuculabs_dev profile image
Nucu Labs

To quote: You don't have to necessary need another container for your database.
You could also have it directly installed on your OS.
.

In my opinion that's the WORST WAY to use Docker. I rather run the 10 containers Confluent provides for Kafka and have everything working and setup than waste time configuring Kafka for my OS (which most probably won't work if it's Windows).

Collapse
javidjms profile image
Javid Mougamadou Author • Edited

For development, you can do theses things :
1) Keep the container awake with a non-stop command ( ex: CMD tail -f /dev/null)

FROM python:3.9.0

...

COPY requirements.txt /data/requirements.txt
RUN pip install -r requirements.txt
COPY . .

# Keep the container awake
CMD tail -f /dev/null
Enter fullscreen mode Exit fullscreen mode

2) Bind a volume on your container (with docker-compose.yml)

version: "3"
services:
  app:
    build:
      context: .
      dockerfile: Dockerfile.local
    volumes:
      - .:/data/
    environment:
      - TZ=Europe/Paris
    ports:
      - "8000:8000"
    networks:
      - default
Enter fullscreen mode Exit fullscreen mode

3) Use a development server with hot-reloader (runserver for Django, run for flask, react-scripts start for Reactjs, etc)

Collapse
confidenceyobo profile image
Confidence Yobo

About running a database on another container I see that as an advantage as it helps isolate parts of your application. But if you want to run your db and app server on the same container, that can also be achieved.