Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install Docker #3

Open
jaylong255 opened this issue Sep 29, 2024 · 3 comments
Open

Install Docker #3

jaylong255 opened this issue Sep 29, 2024 · 3 comments
Assignees

Comments

@jaylong255
Copy link
Member

No description provided.

@jaylong255 jaylong255 self-assigned this Sep 29, 2024
@jaylong255
Copy link
Member Author

To install Docker on Ubuntu, you can follow these steps. This guide assumes you're using a relatively recent version of Ubuntu, where Docker installation has been streamlined:

Step-by-Step Guide to Install Docker on Ubuntu:

  1. Update Package Information:
    Open a terminal and update the package index:

    sudo apt update
  2. Install Required Packages:
    Install a few prerequisite packages which allow apt to use packages over HTTPS:

    sudo apt install -y ca-certificates curl gnupg lsb-release
  3. Add Docker’s Official GPG Key:
    Add the GPG key for the official Docker repository:

    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
  4. Set up the Stable Docker Repository:
    Use the following command to add the stable version of Docker to your system:

    echo \
    "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
    $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
  5. Update Package Information Again:
    Update the package index to recognize the new repository:

    sudo apt update
  6. Install Docker Engine:
    Install the latest version of Docker Engine, Docker CLI, Containerd, and Docker Compose:

    sudo apt install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
  7. Verify Docker Installation:
    After installation, you can verify that Docker is installed correctly by checking the version:

    docker --version

    You should see the version of Docker installed.

  8. Start Docker:
    Docker should start automatically, but if it doesn’t, you can start it with:

    sudo systemctl start docker
  9. Optional - Allow Current User to Run Docker Without sudo:
    If you want to run Docker commands without typing sudo each time, add your user to the docker group:

    sudo usermod -aG docker $USER

    Note: You'll need to log out and log back in for this change to take effect.

  10. Hello World Test:
    Run a simple Docker command to make sure everything works:

    docker run hello-world

    This command will download a test image and run it in a container. If you see the message about the container’s Linux OS and the message "Hello from Docker!", you’ve successfully installed Docker.

This process should give you a fully functional Docker environment on Ubuntu. If you encounter any issues, make sure your system is up to date and consider checking Docker's official documentation or forums for any version-specific installation notes or troubleshooting steps.

@jaylong255
Copy link
Member Author

Docker Compose is already installed by default when you follow the Docker installation steps for Ubuntu, as outlined in my previous response. The command:

sudo apt install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin

installs Docker Compose as well, under the name docker-compose-plugin.

However, if you've installed Docker without Docker Compose or if you want to use a different version of Docker Compose, here's how you can install or update Docker Compose manually:

Manual Installation of Docker Compose

  1. Download Docker Compose:
    First, find the latest version of Docker Compose you want to install. You can check the latest version from Docker's GitHub releases page for Docker Compose or use the current version known at the time of writing. Here's how to download the latest version (as of my last update, which might not be the current one):

    sudo curl -L "https://github.com/docker/compose/releases/download/v2.20.3/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

    Adjust the version number (v2.20.3 in this example) if there's a newer version available.

  2. Apply Executable Permissions:
    After downloading, make sure the file is executable:

    sudo chmod +x /usr/local/bin/docker-compose
  3. Verify Installation:
    Check the version of Docker Compose to ensure it was installed correctly:

    docker-compose --version

    This should output the version you've installed.

Notes:

  • If you installed Docker from Docker's official repository, Docker Compose should already be available.
  • If you prefer to install Docker Compose separately for some reason, remember to check the version compatibility with your Docker Engine version.
  • The manual installation method might be useful if you need a specific version of Docker Compose that isn't provided by the system's package manager or if you're working in an environment where direct control over software versions is necessary.

Potential Conflicts:

  • If you've installed Docker Compose manually, ensure it doesn't conflict with the docker-compose-plugin installed through the package manager. You might need to rename your manually installed docker-compose executable to avoid conflicts or use it with a different name.

By following these steps, you should have Docker Compose installed and ready to use on your Ubuntu system, either through the default installation with Docker or by manual setup.

@jaylong255
Copy link
Member Author

Installing Git on Ubuntu can be done quite straightforwardly via the system's package manager, apt. Here's how you can install Git:

Step-by-Step Guide to Install Git on Ubuntu:

  1. Update Package Index:
    Open a terminal and update the package list to ensure you're getting the latest versions of software:

    sudo apt update
  2. Install Git:
    Install Git with the following command:

    sudo apt install -y git

    The -y flag automatically answers "yes" to any prompts, making the installation process non-interactive.

  3. Verify Installation:
    After installation, verify that Git was installed correctly by checking its version:

    git --version

    This command should output the version of Git you've installed, something like git version 2.30.0.

Additional Configuration (Optional but Recommended):

  • Set Up Your Name and Email:
    Git uses this information for commits. You can set it globally with:

    git config --global user.name "Your Name"
    git config --global user.email "[email protected]"
  • Set Default Editor:
    You might want to specify a default text editor for Git commands that need one:

    git config --global core.editor "nano"

    Replace nano with your preferred editor, like vim or emacs.

  • Configure Colors:
    If you prefer colored outputs for easier reading:

    git config --global color.ui auto

Using Git:

Now that Git is installed, you can start using it to manage source code or other version-controlled content. Here are some basic commands to get you started:

  • Initialize a Git Repository:

    git init
  • Add Files to be Tracked:

    git add .
  • Make a Commit:

    git commit -m "Your commit message"
  • Clone a Remote Repository:

    git clone <repository-url>
  • Pull Updates from a Remote Repository:

    git pull origin <branch-name>
  • Push Changes to a Remote Repository:

    git push origin <branch-name>

Remember, while Git is now installed system-wide, these configuration commands (like setting your name and email) only apply to your user account unless you use sudo or run them as root. If you're managing multiple user accounts on your system and each should have their own Git setup, you'll need to run these configuration commands for each user separately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant