Can I run docker in codespaces? #48003
-
Select Topic AreaQuestion BodyI'm doing a course from frontend masters about sql which require to setup docker. Unfortunately, my pc is really old and only have 4GB pf ram. So, I was wandering if I could follow along with the course using codespaces. If possible, I'd really appreciate your help setting up my codespace since I don't know anything about docker. Here is the docker setup from the course: https://sql.holt.courses/lessons/welcome/docker Two containers I'll need: |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
Just as a brief answer, yes you can. You don't actually need to run Docker inside of your codespace, as it is already a Docker container of its own. What you should do is define a devcontainer config along with a docker-compose config, and then just create a new codespace not from scratch, but from your devcontainer config. |
Beta Was this translation helpful? Give feedback.
-
Yes, this is possible. I just tried it today. |
Beta Was this translation helpful? Give feedback.
-
Absolutely, you can get Docker going in GitHub Codespaces. However, it’s worth mentioning that it doesn’t come pre-installed, so a bit of setup is required. Essentially, to enable Docker functionality, you'll need to put together a .devcontainer configuration in your repository. This involves adding the installation of Docker and mounting the Docker socket (so that) commands related to Docker can run inside your Codespace environment. This way, you’re able to manage containers, build images for Docker (and work with other applications), all from within your cloud-based development space. Yet keep in mind that running Docker here typically depends on what's called "Docker-in-Docker" or DinD. Proper resource management tends to be very important too since it helps prevent issues like excessive use of CPU and memory which could otherwise slow things down significantly. |
Beta Was this translation helpful? Give feedback.
Just as a brief answer, yes you can. You don't actually need to run Docker inside of your codespace, as it is already a Docker container of its own. What you should do is define a devcontainer config along with a docker-compose config, and then just create a new codespace not from scratch, but from your devcontainer config.