• How to manage your docker containers with yacht

How to manage your Docker containers with Yacht

  • User by AddictiveTips Team
  • Calendar Sep 13, 2022
  • Comment No Comments

Docker is a beautiful tool, but it can be hard to manage if you’re unfamiliar with it. Yacht is a program that tries to make things easier by giving users a web UI that can be used to deploy, modify, and manage containers. Here’s how to set up Yacht on your Linux system.

Before we begin

Yacht is an easy-to-use UI for Docker containers . You can use it to edit containers, deploy new ones, manage volumes, and even modify configuration files. However, this software is under heavy development and can sometimes be unstable.

We highly suggest only using Yacht in settings where you aren’t worried about losing valuable data. Be sure to back up your data before using Yacht.

Installing Docker on Linux

Yacht is provided to users through Dockerhub as an image. However, you must install Docker on your system before you attempt to run it. To install Docker on your system, open a terminal window on your server and follow the installation instructions below.

We’ll use Docker via a Snap package on Linux in this guide. Snap is being used because it takes a lot of the difficulty of setting up Docker. To start, you must enable the Snap runtime on your Linux system.

To enable the Snap runtime on Linux, follow our guide on the subject . This guide will go over, in detail, how to set up the Snap package runtime. After setting up the Snap runtime, you can install Docker on your server using the snap install command.

With the Docker tool installed, you can use it as root. However, if you want to use Docker without root, you must enter the following commands in a terminal window.

Pulling the Yacht docker image

You’ll need to pull the Yacht docker image directly from Dockerhub. To pull it to your server (or Linux PC), log into the server’s root account. You can log into root with su .

You likely have the root account locked if you cannot log into the root account. Therefore, you will need to enable it. To enable the root account, do the following.

Set the root password to something secure and memorable. Then, log out of sudo -s with exit.

After logging into the root account, use the following command to create the “yacht” docker volume. This volume will hold all of the Yacht data on the server.

With the new volume created, use the docker run command to pull down your system’s Yacht image from Dockerhub.

Once the image is pulled from Dockerhub, Docker will deploy the image as a container on your system. It will run Yacht on port 8000. You can access the Yacht web UI in any browser with the following URL.

HTTP://local-lan-ip-of-server:8000

Starting the Yacht docker container after installation

Using the docker run command above, Yacht will be deployed via the Docker image and started on Port 8000. However, this command only works for the initial deployment.

If you restart your Linux system, you must use the docker start command to run Yacht. Here’s how.

First, log into the root account using the su – command.

Once logged into the root account, run the docker ps -a command. This command will list all containers on your system. Find the “CONTAINER ID” column and the Yacht container ID.

After copying the Yacht container ID, you can start it up with:

Or, shut it down with:

Logging into Yacht

You’ll need to use the default password and username to log into Yacht. Then, access Yacht via the URL below, enter [email protected] as the user and pass as the password.

Using Yacht

Once you log into Yacht, you’ll be presented with the dashboard. This dashboard will show all running Docker images and their CPU and memory usage.

To manage the containers, click on the Yacht sidebar, select “Applications,” and select your container. Then, once you’ve chosen the container, you’ll see detailed information, including port information, control buttons, running processes, logs, etc.

Manage volumes

It is possible to manage Docker volumes in Yacht. To do it, select the Yacht sidebar, choose “Resources,” and select “Volumes.” From here, you’ll be able to access both used and unused Docker volumes.

Manage Networks

Need to access your Docker network settings? Select the Yacht sidebar, and select the “Network” option. Once you’ve accessed this area, you’re free to modify networking settings, interfaces, etc.

Manage images

If you need to manage Docker images, select the Yacht sidebar, choose the “Resources” button, and click on “Images.” Once inside “Images,” Yacht will let you manage your Docker images.

default avatar image

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed .

Searching for something else?

Chances are, we can find what you're looking for:

Developer Tools

Engage with us.

  • As Seen on TFIR 55
  • Cloud Simplified 56
  • Craft of Code 37
  • DIY Cloud 51
  • HackerSploit 32
  • In the Node Newsletter 43
  • Learnk8s Labs 8
  • Linode Kubernetes with Helm 11
  • OpenAI Versus Project 9
  • Partner Roundups 26
  • Super User 162
  • Tech With Tim Linux Beginners Series 14
  • Terraforming Kubernetes 6
  • Top Docs 75
  • Alexis Ahmed (HackerSploit) 33
  • Andrew Burke 1
  • Austin Gil 21
  • Billy Thompson 14
  • Brandon Hopkins 25
  • Chris Nesbitt-Smith 2
  • Chris Psaltis 1
  • Code with Harry 31
  • Code with Tomi 13
  • Daniele Polencic 2
  • Darcy Declute 1
  • David Burgess 16
  • David Flanagan 1
  • Florian Walther 1
  • Gardiner Bryant 60
  • James Steel 26
  • Jay LaCroix 76
  • Jay Lyman 1
  • Jérôme Petazzoni (Tiny Shell Script) 11
  • Jose Portilla 1
  • Josh | KeepItTechie 21
  • Justin Mitchel 29
  • Kevin Cunningham 1
  • Liam Eagle 2
  • Mauricio “Salaboy” Salatino 2
  • Mike Jung 3
  • Nelson Djalo 6
  • Salman Iqbal 3
  • Sam Hawley 2
  • Sid Palas 10
  • Swapnil Bhartiya 50
  • Talia Nassi 1
  • Tech with Tim 27
  • Walt Ribeiro 17
  • zSecurity 1
  • Customer Stories 37
  • Email Newsletters 43
  • Project Brief 1
  • Webinars 26
  • Cloud Overviews 19
  • Containers (Kubernetes, Docker) 107
  • Databases 27
  • Developer Tools 147
  • Multicloud 3
  • Networking 14
  • Open Source 16
  • Partner Network 40
  • Security 57

In order to see embedded YouTube videos, you must have "performance" cookies enabled in your cookie preferences .

Manage Docker Containers from a Web UI with Yacht Interactive Dashboards

In this video, Brandon from @TechHut shows you how to install and use Yacht, an interactive dashboard for installing and managing Docker containers on your system. Yacht is great for visualizing and maintaining your Docker infrastructure.

Chapters: 0:00 – Introduction 0:18 – What is Yacht? 1:00 – Installing Yacht 3:32 – Logging into Yacht 4:28 – Installing a SSL Certificate 7:42 – Connecting to the Yacht GUI 8:28 – Adding Tools to Yacht 9:00 – Install Librespeed 12:44 – Conclusion

New to Linode? Get started here with a $100 credit! Check out Yacht on the Web. Check out the Yacht Documentation. Subscribe to get notified of new episodes as they come out!

#Linode #Yacht #Docker #AlternativeCloud #OpenSource Product: Linode, Cloud Computing, Yacht; TechHut;

Open Source

yacht docker port

AWESOME Linux Tiling Terminal Emulator | Control Multiple Servers in a Single Window

yacht docker port

Python Web App From Scratch Round 2 With Justin Mitchel!

You might also like….

yacht docker port

How To Install SteamCMD for a Steam Game Server With Tech Hut

yacht docker port

Alpine Linux

yacht docker port

Jason Rohrer

yacht docker port

Focalboard – Get Organized with this Open-Source Self Hosted Trello Alternative

Sign up for the “in the node” newsletter.

Navigation Menu

Search code, repositories, users, issues, pull requests..., provide feedback.

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly.

To see all available qualifiers, see our documentation .

  • Notifications You must be signed in to change notification settings

Releases: SelfhostedPro/Yacht

Yacht alpha v0.0.7 hotfix 1 released.

@SelfhostedPro

Hotfix 1 for v0.0.7 Changelog:

  • Fix for dashboard not loading all apps
  • Fix for projects not appearing when various errors occur
  • Better errors if an app fails to launch
  • Better errors for submitting invalid YAML to a project

Yacht Alpha v0.0.7 Released!

Notable changes:.

  • Shipwright a new template builder is released (pre-alpha)
  • Yacht is now a PWA and if published with SSL you'll be able to install it on most devices for easy access.
  • API Key framework so now applications can interact with Yacht directly (found in user settings when auth is enabled).
  • Changed logs and stats to Server Sent Events so websocket support is no longer needed *this may change in the future as I believe it will be needed for container CLI access
  • Redesigned the look of all the main pages
  • Support for command, memory limits, and cpu in templates and deployments.
  • Better error handling for Projects.
  • Issue where ports were defined more than once
  • Data in dashboards being off
  • Various UI glitches
  • Other various fixes (view merge request for a full list)

Alpha 6 hotfix 1 (v0.0.6-alpha-hf1) Released

Alpha 6 hotifx 1.

  • Added support bundle button to download your docker-compose.yml and all associated logs for you project.
  • Changed the dashboard to significantly improve performance (up to 70% less resource intensive).
  • Optimized the way websockets close (they now close when you navigate away from a page. Previously they would continue to try to send indefinitely).
  • Better application name detection in projects.
  • Fixed deploy from template page in the deploy page.

Alpha 6 (v0.0.6-alpha) Released

V0.0.6-alpha is here.

image

Compose/Projects

image

Please be careful with this. It will remove the running container and launch a new one with the same settings. If you're doing something advanced that I don't have a field in the deploy form for the new version won't have it. Make sure everything in the deploy form looks correct.

Now there are tags with the release date available for both the master and develop branches so if I break something it's easy to fix!

  • Authentication Framwork change (to fastapi-jwt-auth)
  • In-browser docker-compose editor
  • Misc. bugfixes
  • Projects, templates, and apps now follow a similar flow to resources (1-click to go to the list and the plus button to create a new one)
  • Env variable to set default template variables ( BASE_TEMPLATE_VARIABLES=[{"variable": "!config", "replacement": "/yacht/AppData/Config"}, ...] )
  • Editing containers is now available Warning, this can lead to data loss if you don't have a volume or bind setup for storage on the container you're editing. There's a warning in the UI about this.

Alpha 5 (v0.0.5-alpha) Released

Docker compose support is now available under the Projects section (default location is /config/compose/ for your docker-compose projects).

This requires you to set /config to a bind mount. If you've already got /config mounted on a volume you can set /compose/ to a bind mount and set the COMPOSE_DIR environment variable equal to /compose/ . Then put all of your folders that container docker-compose.yml files into that folder.

image

DigitalOcean:

There's now a DigitalOcean marketplace app for Yacht. I would love feedback on it if you get the chance to try it out.

  • Fixed !PGID default variable
  • Unset variables trying to be deployed will now throw an error.
  • closes #194
  • closes #193

Alpha 4 Hotfix 1 (v0.0.4-hf1)

  • Added theming in server settings
  • Saves the theme to your browser storage
  • Custom themes are able to be created various platforms and built with a buildarg
  • Added error handling to templates and removed the requirement for a type setting
  • Fixed port disappearing when bridge is selected. Should only disappear when host isi.
  • Added none as option for restart_policy
  • Various formatting fixes

Alpha 4 (v0.0.4-alpha) Released

Core features added:.

  • Image managment
  • Volume managment
  • Network management
  • Disable Auth (use -e DISABLE_AUTH=True in your run command to disable authentication)
  • Added filter for columns.

App Deploy Form:

  • Added network_mode and network fields

Image Managment:

  • Added image list
  • Added image details
  • Added basic image pull support

Volume Managment:

  • Added volume list
  • Added volume details
  • Added basic volume creation

Network Managment:

  • Added network list
  • Added network details
  • Added ability to create and delete networks (including macvlan and ipvlan)
  • Added network_mode support
  • Changed proxy_read_timeout to 300 seconds. If you run into timeout issues when checking for updates let me know.

Alpha 3 Hotfix 1 (v0.0.3-alpha-hf1)

Fixes update checking for if the image is built locally or missing an image/tag.

Alpha 3 (v0.0.3-alpha) Released

Change log:, bug fixes/minor changes:.

  • Websockets now work with reverse proxies (websocket support required)
  • Reduced data points on dashboard charts from 5 to 3 to increase performance.
  • Misc. other fixes/modifications that I don't remember.
  • Check for app updates (green dot indicates there's an update available)
  • One click container upgrades (spins up a watchtower instance with the --run-once flag targeting the selected container)
  • App actions are available from within the app details view
  • Deploy from template page shows a tabbed view of all templates
  • Template variables now work with environment variables

Server Settings:

  • Separate purge buttons for each type of resource
  • Updates page to update Yacht from within itself (uses same watchtower method as above)

Alpha 2 (v.0.0.2-alpha) Released

This update brings in some great community requested features. Templates/deploy form additions:

  • Port labels: give descriptions to ports so you know what they're for.
  • Container labels: useful for storing information in docker containers and used for things like traefik.
  • Devices: pass through devices into containers (useful for hardware transcoding)

Frontend changes:

  • Descriptive errors for the deploy form so you know what went wrong.
  • When a deploy fails due to a duplicated port (or similar issue that creates a container but doesn't run it) the failed container will be removed so you don't run into a duplicate name issue.
  • Moved deploy form buttons to the right so they're under other buttons you may interact with.
  • Port labels are displayed on the apps list if they are set. (You can hover to get the port number)
  • Container labels and devices added to the app information page
  • Stats graph for CPU will still show even if memory isn't available (mainly affects Pi devices)
  • Added a back button to app pages

Backend changes:

  • Added labels, devices, and port labels to template compatibility.
  • Added labels and devices to db.
  • Added alembic to automatically add tables for users who are upgrading to the latest version (runs every time the app starts to make sure all tables that are needed are added)
  • Added check into stats endpoint for memory issue noted above (arm)

If you run into any issues please open one on GitHub and if you have any feature requests please let me know. If you know python or VueJS I'd be happy to help you get your dev environment setup and get some help making this even better.

DB Tech Reviews

Yacht Installed on Docker – Portainer Alternative

In OpenMediaVault , Tutorials , Video by dbtech September 24, 2020

In this video we’re going to take a look at a Docker application called Yacht.

“Yacht is an alternative to Portainer that aims to make docker more accessible to the everyday person and is focused on selfhosters instead of the enterprise.” – SelfHostedPro

While Yacht operates very much like Portainer, I feel like the interface is more user-friendly and information is more easily available on Yacht than on Portainer.

About Yacht

Yacht’s home screen is a dashboard of all your running containers with information about the memory and CPU being used by each container in real time.

yacht dashboard

From there, you can click the title of any of the containers and get more information about it.

yacht container stats

There are a couple of different ways to install applications. The first way to install an application is by clicking on the “New Application” button on the left side and then filling in each of the black fields for the 4 different steps.

yacht manual install steps

Once you fill out each page, you can then click the “Continue” button and move to the next step. When you get to step 4, you can then deploy the container as you would in Portainer.

Another way is to use templates, again like in Portainer. I’m using the template that was shared on SelfHostedPro’s Yacht page as it’s a great starting point.

yacht templates

Click on the “Deploy” button under the application you’d like to install and you’ll be presented with a familiar screen, but this time, most of the data is already filled out!

yacht template filled out

That’s the basic idea behind Yacht. Please keep in mind that this is still in early development so there may be bugs or things to report. Bugs can be reported via Github or Discord .

Installing Yacht

Installing Yacht is pretty simple as it only takes 2 SSH commands to install.

First, we’ll create a volume:

Then we’ll install the container:

You might need to change the 8000 port to something else if you already have Portainer installed on port 8000.

That’s all there is to installing Yacht. The login credentials are:

  • [email protected]

This has been tested to work with x86 processors as well as Arm processors, so you should be able to install it on just about any hardware you have laying around.

Github: https://github.com/SelfhostedPro/Yacht

Discord: https://discord.gg/srRUF5S

OpenMediaVault Tutorials

If you’re interested in other tutorials for your home server, check here: https://dbtechreviews.com/category/openmediavault/

/=========================================/

Like what I do? Want to be generous and help support my channel?

Here are some ways to support:

Patreon: https://dbte.ch/patreon

Ko-fi: https://dbte.ch/kofi

Remember to leave a like on this video and subscribe if you want to see more!

Twitter: https://dbte.ch/tw

Facebook: https://dbte.ch/fb

Subscribe: https://dbte.ch/ytsub

A web interface for managing docker containers with an emphasis on templating to provide one-click deployments of dockerized applications. Think of it like a decentralized app store for servers that anyone can make packages for.

Additional support and community assistance can be found in our Discord group, https://discord.gg/JfsebxqKDW

Features- Container templating compatibility (Portainer compatible) ​

  • Basic container management
  • Easy template updating
  • Template Variables to allow for a one-click experience
  • Guided container deployment
  • Dashboard for monitoring all of your docker containers in one place
  • Docker-compose compatibility and editor
  • One click editing of containers

Features (Coming Soon!) ​

  • User Management
  • Container CLI attachment If you want something that's not planned please open a feature request issue and we'll see about getting it added.

Templates ​

Currently, Yacht is compatible with portainer templates. You'll add a template url in the "Add Template" settings. The template will be read, separated into apps, and imported into the database. The apps associated with the templates are linked via a db relationship so when the template is removed, so are the apps associated with it. We store the template url as well so we can enable updating templates with a button press.

We recommend starting with:

In templates you are able to define variables (starting with ! ) to have them automatically replaced by whatever variable the user has set in their server settings (ie. !config will be replaced by /yacht/AppData/Config by default).

Virtualization Howto

Yacht vs. Portainer – Docker dashboard comparison

f50b052b cc32 46c3 9fe0 d37121b3b121

  • A call out to a feature that I would like to see on a Yacht machine is the ability to access your containers CLI from the Yacht GUI.
  • When you start working with Docker or containers in general, one of the first things you will probably want is some type of GUI to help with day-to-day workflows and operations for managing Docker containers and Docker apps with an easy-to-access web interface.
  • It is considered to be a Portainer alternative and provides many of the same features in a yacht compare Portainer comparison.

When you start working with Docker or containers in general, one of the first things you will probably want is some type of GUI to help with day-to-day workflows and operations for managing Docker containers and Docker apps with an easy-to-access web interface. There are a couple of solutions out there providing great Docker containers dashboard solutions, Yacht and Portainer. Let’s look at Yacht vs. Portainer and see what features and capabilities each offers.

Take a look at my video comparison of the two products here:

Why a Docker containers dashboard solution?

As you get into working with Docker containers, having a GUI tool to interact with your containers saves time and helps to visualize the Docker app’s infrastructure. Docker has a very robust command line interface, allowing you to do basically anything you need to do from the command line.

However, for newbies starting out and day-to-day management, the command line can be cumbersome for carrying out the required activities. A point-and-click interface to navigate your Docker infrastructure offers many advantages for managing Docker applications.

What is Yacht?

To begin, what is Yacht? Yacht is a web interface for managing Docker containers and focuses on templating. With templates, you can have one-click deployments of dockerized applications.

yacht docker port

Yacht refers to this as a decentralized app store for servers for which you can make packages in your environment. It is considered to be a Portainer alternative and provides many of the same features in a yacht compare Portainer comparison.

Features of Yacht

Comparing Yacht vs. Portainer, Yacht provides many features for those wanting to manage their Docker apps and containers. Those include the following:

Templating functionality (Portainer compatible)

Container management (basic features)

Updating templates

Use template variables for one-click deployment

Container deployment wizard

Docker containers dashboard for seeing all containers in one place

Docker compose support and editor

One-click editing of containers and lifecycle management

Ability to view logs

Create Projects (Docker compose)

Nice menu driven interface from the left side

So, Yacht allows you to run multi-container applications with a GUI dashboard interface to interact with your containers from a simple website interface.

Compose Support

Yacht does include Docker compose support, using the built-in Projects included with Yacht. Using the Projects feature, you can enter a new Compose Template.

yacht docker port

Missing features currently

A call out to a feature that I would like to see on a Yacht machine is the ability to access your containers CLI from the Yacht GUI. This is a feature that Yacht mentions are coming soon.

The features marked as “coming soon” currently include the following:

User Management

Container CLI attachment

Another feature in Yacht that isn’t quite as good as Portainer is the App

Podman support

One cool feature that I like with Yacht is it is compatible with Podman. You can perform the same installation with Podman as you can with Docker:

Yacht install

If you are not installing in a self-hosted Docker server , there are a few options for installing Yacht. These include Docker, OpenMediaVault, Docker Compose, or DockSTARTer. The process to install Yacht in a self-hosted environment is super simple.

Self-hosted Yacht install example

For a self-hosted Docker instance, you have two lines to enter to get up and running:

Many who want to try out Yacht may already be running Portainer. If that is the case, you will need to adjust the external port 8000 to 8001 or something else to run them side-by-side.

yacht docker port

Log in with the [email protected] pass credentials.

yacht docker port

What is Portainer?

Portainer is a well-known container management platform providing a rich GUI interface to work with your containers, applications, templates, config maps, secrets, etc. It helps to reduce the complexity of container adoption and addresses security challenges.

Portainer works with more than Docker

Comparing Yacht vs. Portainer, Portainer is not only a tool that understands Docker apps, it also understands and works with Docker, Swarm, Nomad, and Kubernetes. Comparing Portainer to Yacht, it is a much more fully-featured tool that is also much more polished in its look and feel. It has been around longer and shows from a feature and useability standpoint.

Below is the overview dashboard of the Portainer connected to a Docker host.

yacht docker port

Looking at your list of running containers.

yacht docker port

Portainer features

Portainer has many great features, including:

Overview dashboard

Image management

Built-in app templates

Visibility of Docker networking

Volumes, events, and host configuration

Ability to implement stacks using Docker Compose

Docker exec console – Managing Docker containers

Using the Docker exec console provides a great way to access the Docker CLI when needed from the Docker dashboard. As this is currently a feature missing from Yacht, Portainer is the tool of choice if this is a requirement. Honestly, it is a great feature to be able to expect to the console when needed directly from your Docker container dashboard.

Portainer install

The Portainer installation is very similar to Yacht. It is a couple of commands to get started with a self-hosted environment:

Portainer Community Edition vs. Business Edition

There are two versions of Portainer available – Community Edition and Business Edition. To note the difference between those two versions, Community Edition is free and open-source software. It is designed for individuals, home lab users, or very small environments that want to use Portainer.

Business Edition is commercially supported software. It includes features with Security, Access Management, Permissions, Auditing, and making ensuring you want to take Portainer into production.

Final Thoughts comparing Yacht vs. Portainer

Looking at Yacht vs. Portainer, both Yacht and Portainer are excellent free and open-source tools allowing you to manage and configure your Docker containers in a web interface using a modern GUI. Yacht is definitely the newer and less fully-featured tools of the two. I really like what I see with Yacht. However, it is missing some of the bells and whistles provided by Portainer, like exec CLI support from the interface.

Portainer also provides Kubernetes integration which does not appear to be supported by Yacht. Yacht has documented support for Podman, which isn’t shown with Portainer, although several blog posts cover how to install Portainer with Podman.

Check out Yacht here: Welcome To Yacht | Yacht

Check out Portainer here: Powerful container management software for Platform Teams, DevOps, Dev ( portainer.io )

Subscribe to VirtualizationHowto via Email 🔔

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Email Address

Photo of Brandon Lee

Brandon Lee

Related articles.

yacht docker port

Best docker containers for Synology NAS

The best Docker container commands you need to know

Best Docker Containers Commands You Need to Know

yacht docker port

Docker Desktop Starting Forever Windows 11 or 10 Error

Docker architecture and components

Best Docker Containers for Home Server

Leave a reply cancel reply.

Your email address will not be published. Required fields are marked *

Notify me of new posts by email.

This site uses Akismet to reduce spam. Learn how your comment data is processed .

Docker Best Practices: Choosing Between RUN, CMD, and ENTRYPOINT

yacht docker port

Jay Schmidt

Docker’s flexibility and robustness as a containerization tool come with a complexity that can be daunting. Multiple methods are available to accomplish similar tasks, and users must understand the pros and cons of the available options to choose the best approach for their projects.

One confusing area concerns the RUN , CMD , and ENTRYPOINT Dockerfile instructions. In this article, we will discuss the differences between these instructions and describe use cases for each.

2400x1260 choosing between run cmd and entrypoint

The RUN instruction is used in Dockerfiles to execute commands that build and configure the Docker image. These commands are executed during the image build process, and each RUN instruction creates a new layer in the Docker image. For example, if you create an image that requires specific software or libraries installed, you would use RUN to execute the necessary installation commands.

The following example shows how to instruct the Docker build process to update the apt cache and install Apache during an image build:

RUN instructions should be used judiciously to keep the image layers to a minimum, combining related commands into a single RUN instruction where possible to reduce image size.

The CMD instruction specifies the default command to run when a container is started from the Docker image. If no command is specified during the container startup (i.e., in the docker run command), this default is used. CMD can be overridden by supplying command-line arguments to docker run .

CMD is useful for setting default commands and easily overridden parameters. It is often used in images as a way of defining default run parameters and can be overridden from the command line when the container is run. 

For example, by default, you might want a web server to start, but users could override this to run a shell instead:

Users can start the container with docker run -it <image> /bin/bash to get a Bash shell instead of starting Apache.  

The ENTRYPOINT instruction sets the default executable for the container. It is similar to CMD but is overridden by the command-line arguments passed to docker run . Instead, any command-line arguments are appended to the ENTRYPOINT command.

Note: Use ENTRYPOINT when you need your container to always run the same base command, and you want to allow users to append additional commands at the end. 

ENTRYPOINT is particularly useful for turning a container into a standalone executable. For example, suppose you are packaging a custom script that requires arguments (e.g., “my_script extra_args” ). In that case, you can use ENTRYPOINT to always run the script process ( “my_script” ) and then allow the image users to specify the “extra_args” on the docker run command line. You can do the following:

Combining CMD and ENTRYPOINT

The CMD instruction can be used to provide default arguments to an ENTRYPOINT if it is specified in the exec form. This setup allows the entry point to be the main executable and CMD to specify additional arguments that can be overridden by the user.

For example, you might have a container that runs a Python application where you always want to use the same application file but allow users to specify different command-line arguments:

Running docker run myimage --user-arg executes python /app/my_script.py --user-arg .

The following table provides an overview of these commands and use cases.

Command description and use cases

Defines the default executable of a Docker image. It can be overridden by arguments.Utility images allow users to pass different executables and arguments on the command line.
Defines the default executable. It can be overridden by the arguments.Images built for a specific purpose where overriding the default executable is not desired.
Executes commands to build layers.Building an image

What is PID 1 and why does it matter?

In the context of Unix and Unix-like systems, including Docker containers, PID 1 refers to the first process started during system boot. All other processes are then started by PID 1, which in the process tree model is the parent of every process in the system. 

In Docker containers, the process that runs as PID 1 is crucial, because it is responsible for managing all other processes inside the container. Additionally, PID 1 is the process that reviews and handles signals from the Docker host. For example, a SIGTERM into the container will be caught and processed by PID 1, and the container should gracefully shut down.

When commands are executed in Docker using the shell form, a shell process ( /bin/sh -c ) typically becomes PID 1. Still, it does not properly handle these signals, potentially leading to unclean shutdowns of the container. In contrast, when using the exec form, the command runs directly as PID 1 without involving a shell, which allows it to receive and handle signals directly. 

This behavior ensures that the container can gracefully stop, restart, or handle interruptions, making the exec form preferable for applications that require robust and responsive signal handling.

Shell and exec forms

In the previous examples, we used two ways to pass arguments to the RUN , CMD , and ENTRYPOINT instructions. These are referred to as shell form and exec form. 

Note: The key visual difference is that the exec form is passed as a comma-delimited array of commands and arguments with one argument/command per element. Conversely, shell form is expressed as a string combining commands and arguments. 

Each form has implications for executing commands within containers, influencing everything from signal handling to environment variable expansion. The following table provides a quick reference guide for the different forms.

Shell and exec form reference

Takes the form of . or
Takes the form of . or

In the shell form, the command is run in a subshell, typically /bin/sh -c on Linux systems. This form is useful because it allows shell processing (like variable expansion, wildcards, etc.), making it more flexible for certain types of commands (see this shell scripting article for examples of shell processing). However, it also means that the process running your command isn’t the container’s PID 1, which can lead to issues with signal handling because signals sent by Docker (like SIGTERM for graceful shutdowns) are received by the shell rather than the intended process.

The exec form does not invoke a command shell. This means the command you specify is executed directly as the container’s PID 1, which is important for correctly handling signals sent to the container. Additionally, this form does not perform shell expansions, so it’s more secure and predictable, especially for specifying arguments or commands from external sources.

Putting it all together

To illustrate the practical application and nuances of Docker’s RUN , CMD , and ENTRYPOINT instructions, along with the choice between shell and exec forms, let’s review some examples. These examples demonstrate how each instruction can be utilized effectively in real-world Dockerfile scenarios, highlighting the differences between shell and exec forms. 

Through these examples, you’ll better understand when and how to use each directive to tailor container behavior precisely to your needs, ensuring proper configuration, security, and performance of your Docker containers. This hands-on approach will help consolidate the theoretical knowledge we’ve discussed into actionable insights that can be directly applied to your Docker projects.

RUN instruction

For RUN , used during the Docker build process to install packages or modify files, choosing between shell and exec form can depend on the need for shell processing. The shell form is necessary for commands that require shell functionality, such as pipelines or file globbing. However, the exec form is preferable for straightforward commands without shell features, as it reduces complexity and potential errors.

CMD and ENTRYPOINT

These instructions control container runtime behavior. Using exec form with ENTRYPOINT ensures that the container’s main application handles signals directly, which is crucial for proper startup and shutdown behavior.   CMD can provide default parameters to an ENTRYPOINT defined in exec form, offering flexibility and robust signal handling.

Signal handling and flexibility

Using ENTRYPOINT in exec form and CMD to specify parameters ensures that Docker containers can handle operating system signals gracefully, respond to user inputs dynamically, and maintain secure and predictable operations. 

This setup is particularly beneficial for containers that run critical applications needing reliable shutdown and configuration behaviors. The following table shows key differences between the forms.

Key differences between shell and exec

Commands without brackets. Run by the container’s shell, e.g., .Commands with brackets. Run directly, not through a shell.
Inherits environment variables from the shell, such as and .Does not inherit shell environment variables but behaves the same for instruction variables.
Supports sub-commands, piping output, chaining commands, I/O redirection, etc.Does not support shell features.
Most shells do not forward process signals to child processes.Directly traps and forwards signals like .
Can cause issues with signal forwarding.Recommended due to better signal handling.
Not possible with the shell form.If the first item in the array is not a command, all items are used as parameters for the .

Figure 1 provides a decision tree for using RUN , CMD , and ENTRYPOINT in building a Dockerfile.

2400x1260 run cmd entrypoint

Figure 2 shows a decision tree to help determine when to use exec form or shell form.

2400x1260 decision tree exec vs shell

The following section will walk through the high-level differences between CMD and ENTRYPOINT . In these examples, the RUN command is not included, given that the only decision to make there is easily handled by reviewing the two different formats.

Test Dockerfile

First build.

We will build this image and tag it as ab .

Run with CMD ab

Without any arguments, we get a usage block as expected.

However, if I run ab and include a URL to test, I initially get an error:

The issue here is that the string supplied on the command line — https://jayschmidt.us — is overriding the CMD instruction, and that is not a valid command, resulting in an error being thrown. So, we need to specify the command to run:

Run with ENTRYPOINT

In this run, we remove the CMD ab instruction from the Dockerfile, replace it with ENTRYPOINT ["ab"] , and then rebuild the image.

This is similar to but different from the CMD command — when you use ENTRYPOINT , you cannot override the command unless you use the –entrypoint flag on the docker run command. Instead, any arguments passed to docker run are treated as arguments to the ENTRYPOINT .

What about syntax?

In the example above, we use ENTRYPOINT ["ab"] syntax to wrap the command we want to run in square brackets and quotes. However, it is possible to specify ENTRYPOINT ab (without quotes or brackets). 

Let’s see what happens when we try that.

Your first thought will likely be to re-run the docker run command as we did for CMD ab above, which is giving both the executable and the argument:

This is because ENTRYPOINT can only be overridden if you explicitly add the –entrypoint argument to the docker run command. The takeaway is to always use ENTRYPOINT when you want to force the use of a given executable in the container when it is run.

Wrapping up: Key takeaways and best practices

The decision-making process involving the use of RUN , CMD , and ENTRYPOINT , along with the choice between shell and exec forms, showcases Docker’s intricate nature. Each command serves a distinct purpose in the Docker ecosystem, impacting how containers are built, operate, and interact with their environments. 

By selecting the right command and form for each specific scenario, developers can construct Docker images that are more reliable, secure, and optimized for efficiency. This level of understanding and application of Docker’s commands and their formats is crucial for fully harnessing Docker’s capabilities. Implementing these best practices ensures that applications deployed in Docker containers achieve maximum performance across various settings, enhancing development workflows and production deployments.

  • Stay updated on the latest Docker news! Subscribe to the Docker Newsletter .
  • Get the latest release of Docker Desktop .
  • New to Docker? Get started .
  • Have questions? The Docker community is here to help .

Docker Desktop 4.32: Beta Releases of Compose File Viewer, Terminal Shell Integration, and Volume Backups to Cloud Providers

How an ai assistant can help configure your project’s git hooks, how to run hugging face models programmatically using ollama and testcontainers.

Jul 15, 2024

  • Engineering

COMMENTS

  1. Install Yacht

    This will start Yacht on port 8000 (change this to 8001 if you're also using portainer). ... Once docker is installed click on "Yacht" and then "Install" Once it's installed you can use the button to open Yacht. via Docker Compose# The following is an example docker-compose.yml file to deploy Yacht: docker-compose.yml---version: "3"

  2. Getting Started

    docker volume create yacht. docker run -d -p 8000:8000 -v /var/run/docker.sock: ... After that you can access Yacht on port 8000 on your server in a web browser. If you're using Yacht alongside portainer you'll want to change the 8000 on the left of the : to 8001, then it will be available on that port on your host.

  3. GitHub

    A web interface for managing docker containers with an emphasis on templating to provide 1 click deployments. Think of it like a decentralized app store for servers that anyone can make packages for. - SelfhostedPro/Yacht

  4. A Step-by-Step Guide to Installing the Yacht Docker GUI

    5. Execute the docker run command below to download the Yacht Docker GUI image from Docker Hub and create a container called yacht (arbitrary) based on the image.. Once completed, you will have a Yacht Docker GUI container running, which is accessible through port 8000 with the following command breakdown:. d - This flag runs the container in the background (detached mode) without attaching ...

  5. Beginners Guide · SelfhostedPro/Yacht Wiki · GitHub

    After that you can access Yacht on port 8000 on your server in a web browser. If you're using Yacht alongside portainer you'll want to change the 8000 on the left of the : to 8001, then it will be available on that port on your host. Once you're at the login page you can login with the username [email protected] and the password pass.

  6. Welcome To Yacht

    Yacht lets you focus on what apps you want to run instead of worrying about how to deploy them. Compose Support Out of The Box. Managing large docker projects has never been easier. Import compose projects you're already using or write new ones easily using the built in editor. Docs. Getting Started; Projects;

  7. Reverse Proxy Setup

    Using https and forcing SSL. Set the Yacht container to bridged network. Leave Nginx Proxy Manager on its default proxy network. Configure Nginx using the subdomain. The IP of the docker host (such as 192.168..x or equiv.). The docker port you set Yacht to such as 8000. Use http between the Nginx host and the Yacht container. Additional security:

  8. Yacht

    With that being said, Yacht is still here to stay and was built for templates that allow you to launch Docker containers quick and easy. Yacht comes shipped with a default template packed with over 100 apps ready to be deployed. Yacht makes it easy to see everything about the containers you have running. Here on the container application info ...

  9. How to Manage Docker Containers with a GUI using Yacht

    In this guide, you will install Yacht with Docker on a Vultr cloud server. Prerequisites. Deploy a Docker Instance using the Vultr Marketplace App. Access the Server. Install Yacht on Docker ... # docker-compose up -d Setup Yacht. Allow port 8000 through the firewall. On Ubuntu: # ufw allow 8000/tcp On CentOS:

  10. How to manage your Docker containers with Yacht

    Starting the Yacht docker container after installation. Using the docker run command above, Yacht will be deployed via the Docker image and started on Port 8000. However, this command only works for the initial deployment. If you restart your Linux system, you must use the docker start command to run Yacht. Here's how.

  11. Manage Docker Containers from the Web with Yacht

    Manage Docker Containers from a Web UI with Yacht Interactive Dashboards. In this video, Brandon from @TechHut shows you how to install and use Yacht, an interactive dashboard for installing and managing Docker containers on your system. Yacht is great for visualizing and maintaining your Docker infrastructure. Chapters: 0:00 - Introduction.

  12. Install Yacht

    Click on "Docker" and then "Install" (Optional) Click on advanced under "Yacht (Alpha)" and select the port you want to use. Once docker is installed click on "Yacht" and then "Install" Once it's installed you can use the button to open Yacht. via Docker Compose The following is an example docker-compose.yml file to deploy Yacht:

  13. Docker Hub Container Image Library

    Yacht is a Docker management tool that allows you to easily deploy and manage containerized applications. With Yacht, you can browse, search, and run images from Docker Hub, the world's largest container registry, or from your own private repositories. Yacht also provides a web interface, a REST API, and a CLI for managing your containers.

  14. Intro

    Features. Container templating compatibility (Portainer compatible) Basic container management. Easy template updating. Template Variables to allow for a one-click experience. Guided container deployment. Dashboard for monitoring all of your docker containers in one place. Docker-compose compatibility and editor. One click editing of containers.

  15. Yacht (Container Management UI) Alpha 6 is released [Docker ...

    I'll look at changing the port labels to follow the primary color defined in the theme. It uses the latest version of docker-compose so it should support anything that's supported by that version. I'll definitely be working on adding more customization to the dashboard page soon as well. Currently it leaves a lot to be desired.

  16. Releases · SelfhostedPro/Yacht · GitHub

    Port labels: give descriptions to ports so you know what they're for. Container labels: useful for storing information in docker containers and used for things like traefik. Devices: pass through devices into containers (useful for hardware transcoding) Frontend changes: Deploy forms: Descriptive errors for the deploy form so you know what went ...

  17. Getting Started

    After that you can access Yacht on port 8000 on your server in a web browser. If you're using Yacht alongside portainer, you'll want to change the 8000 on the left of the : to 8001, then it will be available on that port on your host.; If SELinux is enabled on the host, you'll need to pass the --privileged flag to docker when deploying Yacht.; Once you're at the login page you can login with ...

  18. How to install Yacht on Linux Server for Docker

    In this post, I'll show you how to install Yacht on your Linux server. yacht is a web interface for managing Docker containers that offers an easy-to-use dashboard to monitor and manage your containers. Table of Contents: What is Yacht? Install Docker; Install Yacht; Change the default login credentials; Reset Yacht Password/Username(optional)

  19. Yacht Installed on Docker

    "Yacht is an alternative to Portainer that aims to make docker more accessible to the everyday person and is focused on selfhosters instead of the enterprise." - SelfHostedPro. While Yacht operates very much like Portainer, I feel like the interface is more user-friendly and information is more easily available on Yacht than on Portainer.

  20. Intro

    Intro | Yacht. Welcome. Intro. Intro. A web interface for managing docker containers with an emphasis on templating to provide one-click deployments of dockerized applications. Think of it like a decentralized app store for servers that anyone can make packages for. Additional support and community assistance can be found in our Discord group ...

  21. Yacht vs. Portainer

    Comparing Portainer to Yacht, it is a much more fully-featured tool that is also much more polished in its look and feel. It has been around longer and shows from a feature and useability standpoint. Below is the overview dashboard of the Portainer connected to a Docker host. Looking at your list of running containers.

  22. Projects

    Projects. Docker-compose projects are a container orchestration tool to help manage containers that need to talk to each other. Yacht provides an in browser docker-compose editor as well as a way to manage them easily via the projects tab in the yacht UI. The easiest way to get started is to find a project that you want to launch, then click on ...

  23. How to Start Docker Containers

    docker run Examples. The docker run command simplifies container management by fitting all the container configuration parameters into a single command. The following example uses docker run to:. Create a container based on the official nginx image.; Map the external port 8080 to the container port 80.; Name the container nginx-test.; Run the container in detached mode, i.e., without attaching ...

  24. Docker Best Practices: Choosing Between RUN, CMD, and ENTRYPOINT

    $ docker run ab ab: wrong number of arguments Usage: ab [options] [http[s]://]hostname[:port]/path Options are: -n requests Number of requests to perform -c concurrency Number of multiple requests to make at a time -t timelimit Seconds to max. to spend on benchmarking This implies -n 50000 -s timeout Seconds to max. wait for each response ...

  25. Templates Explained

    Templates Explained. This page will go over building a template. The templates are all compatible with portainer v1 templates so you can always check that documentation too. All of the keys (type, name, title, etc.) are optional and will simply be blank if left empty. Single app templates will be surrounded by {} as is standard for .json files.