Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Docker: Difference between revisions

From Nest Guides
Samuel (talk | contribs)
fix issue w/ docker init commands
Samuel (talk | contribs)
→‎Rootless Docker: reference new nest CLI setup command
 
Line 6: Line 6:


== Rootless Docker ==
== Rootless Docker ==
Rootless Docker is relatively simple to set up - just run the following commands in the terminal:
Rootless Docker is super easy to set up with the Nest CLI! Just run:
  dockerd-rootless-setuptool.sh install
  nest setup docker
sed -i '/^ExecStart/ s/$/ --exec-opt native.cgroupdriver=cgroupfs /' ~/.config/systemd/user/docker.service
It will run all of the necessary commands to get rootless Docker working for you on Nest!
systemctl --user daemon-reload
systemctl --user enable docker
systemctl --user restart docker
docker context use rootless
These commands will setup rootless Docker, fix a bug, start the Docker service, and configure the <code>docker</code> command to use rootless Docker. Once you run these commands, you'll be able to use Docker!
 
== Using Docker ==
== Using Docker ==
There's two core Docker concepts to understand before using Docker: images and containers. Containers are like what was said at the start of this guide - just an isolated box where a program can run, with all of its dependencies already there. But what's an image? An image is a read-only template with instructions for creating a Docker container. There's lots of different images that you can use; for example, there's one for PostgreSQL, another for a Minecraft server, and so on. You'll find most Docker images on [https://hub.docker.com/ Docker Hub].
There's two core Docker concepts to understand before using Docker: images and containers. Containers are like what was said at the start of this guide - just an isolated box where a program can run, with all of its dependencies already there. But what's an image? An image is a read-only template with instructions for creating a Docker container. There's lots of different images that you can use; for example, there's one for PostgreSQL, another for a Minecraft server, and so on. You'll find most Docker images on [https://hub.docker.com/ Docker Hub].

Latest revision as of 16:37, 14 April 2024

Docker is a powerful platform and tool for developing, shipping, and running applications. It utilizes a technology called containerization, which basically packages whatever program you'd like into a lightweight container, isolated from the system. Containers are great to use since they allow you to run whatever you'd like with a single command, without having to install dependencies. For example, you can run MySQL in a container with a single command!

Need a database? Nest runs an instance of PostgreSQL that should work for most use cases!

Usually, Docker runs as a system-wide service only accessible by the root user. However, since users on Nest don't have access to the root user, users can't utilize the system-wide service. Instead, you should use rootless Docker.

Rootless Docker

Rootless Docker is super easy to set up with the Nest CLI! Just run:

nest setup docker

It will run all of the necessary commands to get rootless Docker working for you on Nest!

Using Docker

There's two core Docker concepts to understand before using Docker: images and containers. Containers are like what was said at the start of this guide - just an isolated box where a program can run, with all of its dependencies already there. But what's an image? An image is a read-only template with instructions for creating a Docker container. There's lots of different images that you can use; for example, there's one for PostgreSQL, another for a Minecraft server, and so on. You'll find most Docker images on Docker Hub.

To create a container, you can use the docker run command. Try running docker run hello-world. You should see a message from Docker after the image is downloaded!

There's a lot more that you can do with Docker. Most images on Docker Hub will give you some instructions on how to use it (such as required environment variables). Check out the Docker docs for more information!