You can learn more about Docker Compose in our dedicated guide. If the variable's not set in your shell, DEFAULT will be used as the value instead. ![]() ![]() Environment variables can be interpolated into strings using the $ syntax. Both containerd and docker should be running on your Docker host. The Docker Engine required the containerd, which is used as the default container engine. During this writing, Docker v24.0.4 is installed on Debian 12. You can pass shell environment variables into containers ( environments) and setup Docker port binds ( ports). After installing Docker, run the following command to check the version. Containers are defined under the services node, with each container declaring its Docker image. The example YAML file showcases a few Docker Compose features. Use docker-compose down to remove the containers. 1.If the old docker version is installed on your Debian system then, first uninstall the old version docker packages that were installed with the name of docker, docker.io, or docker-engine. You can stop them both using docker-compose stop. You'll see both images get pulled from Docker Hub. You can launch both the services by running docker-compose up -d. Now log out from the terminal and log back in to take effect from the changes.Here's a simple docker-compose.yml to run a PHP web server and a MySQL database: Now, add the user to the group (docker): sudo usermod -aG docker $USER To do so, first, create a docker group using the groupadd command: sudo groupadd docker So how about you configure it in such a way that you don't have to use sudo? If you noticed, while running a hello-world image, I used sudo.Īnd this may not be convenient. Here's a replay of all the above commands. The hello-world docker image is tiny and solely aimed to check if Docker is running fine. To verify the Docker installation, you can install the hello-world image: sudo docker run hello-world ![]() Now, you can update the repository index and install Docker using the following command: sudo apt update & sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin The extra \ at the end of each line in the above command is just a way to add new line so that you can easily see the entire command. Sudo tee /etc/apt//docker.list > /dev/null etc/os-release & echo "$VERSION_CODENAME")" stable" | \ ![]() Once done, use the chmod command to change the permissions of the docker.gpg file: sudo chmod a+r /etc/apt/keyrings/docker.gpgĪnd finally, use the following command to set up the repository for Docker: echo \ Next, download the GPG key and store it in the /etc/apt/keyrings/etc/apt/keyrings directory using the given command: curl -fsSL | sudo gpg -dearmor -o /etc/apt/keyrings/docker.gpg Now, let's create a directory to store the keyrings using the following: sudo install -m 0755 -d /etc/apt/keyrings So first, use the following command to install prerequisites for this method: sudo apt update & sudo apt install ca-certificates curl gnupg The main reason why I recommend using this method is you get hassle-free upgrades as repositories can easily be updated! Install Docker on Debian 12 using Docker repositories Once done, you can proceed to the shown installation methods. But before you jump to the installation methods, removing the previous installation of Docker is necessary.Īnd to do so, you can use the following command: sudo apt purge docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |