Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
World desk10 min

How to Create a Docker Container on a Linux VPS

A practical guide to installing Docker Engine on an Ubuntu VPS, choosing between docker create and docker run, publishing ports, verifying containers, and fixing common startup and networking problems.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To create a Docker container on a Linux VPS, install Docker Engine, obtain an image, create and start a container, publish the application port, and verify that it is running. The shortest working example on a VPS is sudo docker run -d --name web -p 8080:80 nginx. It creates a container from the nginx image, runs it in the background, and maps port 8080 on the VPS to port 80 in the container.

What you need before creating a container

A container is not created directly by the Linux VPS provider. Docker Engine must already be installed and its daemon must be available on the server. Docker then uses an image, such as nginx, as the read-only starting point for a container and adds a writable container layer above it.

As an Amazon Associate I earn from qualifying purchases.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • A Linux VPS with shell access: Connect over SSH with an account that can run commands through sudo, or use an account with the permissions required by your Docker installation.
  • Docker Engine: On Ubuntu, use Docker’s official apt repository and installation instructions rather than relying on an unrelated package source.
  • A container image: The examples use nginx and Docker’s docker/welcome-to-docker image.
  • A network plan: Decide which VPS port should receive traffic and which port the application listens on inside the container.

Remove unofficial or conflicting packages before installing Engine. Docker’s Ubuntu guidance specifically calls out packages such as docker.io and docker-compose. Leaving conflicting packages installed can result in a different Docker implementation, mismatched commands, or a daemon that does not behave as expected.

Install Docker Engine on an Ubuntu VPS

1. Remove conflicting packages

Before installing Docker Engine, remove conflicting packages identified by Docker’s Ubuntu instructions, including docker.io and docker-compose when they are present. The exact removal command depends on the Ubuntu release and the packages currently installed, so follow the current official Ubuntu installation page for the supported command sequence.

#1 Best Overall
Sale
TOZO A1 Wireless Earbuds Bluetooth 5.3 Light Weight in Ear Headphones | IPX5 Waterproof,2 Mics for AI Calls,Immersive Premium Sound Bass Headset with Charging Case,32 EQ via App Black
  • [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
  • [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
  • [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
  • [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
  • [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.

2. Configure Docker’s official apt repository

Use Docker’s official apt repository and its current key and repository setup for your Ubuntu release. Repository instructions change as supported Ubuntu versions change; copying an old blog post can install an obsolete package or point apt at the wrong release.

3. Install Engine and confirm the CLI is available

Complete the official Engine installation, then run a harmless Docker command such as docker ps. An empty result is normal on a new host: it means the client can communicate with the daemon and there are no running containers. If the shell reports that docker is not found, or the client cannot reach the daemon, finish the Engine installation before trying to create a container.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The commands below use sudo docker so they work on a typical VPS account without assuming that the account has been added to a Docker group. If your administrator has configured non-root Docker access, the same commands can be run without sudo.

docker create versus docker run

The two commands are related but are not interchangeable in a workflow. docker create prepares a container without starting it. docker start starts that existing stopped container. docker run performs creation and startup in one operation.

Command What it does When to use it What happens next
docker create Creates a writable container from an image and configures its command, name, ports, and other options. When you want to prepare a container first and start it later. The container remains stopped until you run docker start NAME.
docker start Starts an existing stopped container. When the container was created earlier or stopped temporarily. The same container and its configured settings are used again.
docker run Combines container creation and startup. For the normal one-command deployment path. The new container starts immediately; with -d, the command returns to your shell.

A common mistake is running docker create and then checking only running containers. The container exists, but it will not appear in docker ps until it has been started. Use docker ps -a to include stopped and never-started containers.

Create a container first, then start it

This two-step pattern makes the distinction between configuration and execution explicit:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Sale
Smart Watch for Men Women Compatible with iPhone Samsung Android Phone 1.69 inch Full Touch Screen IP68 Waterproof Bluetooh Fitness Tracker Heart Rate/Sleep Monitor (Black)
  • 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
  • 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
  • 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
  • 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
  • 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.
  1. Create the container: sudo docker create --name web -p 8080:80 nginx
  2. Start the container: sudo docker start web
  3. Check its state: sudo docker ps -a

The first command creates a container named web from the nginx image. The --name web option gives it a stable, human-readable name instead of a randomly generated one. The -p 8080:80 option records a port mapping from port 8080 on the VPS to port 80 in the container.

The second command starts the already-created container. Starting by name is useful when a deployment process separates provisioning from activation, or when you intentionally want to inspect a container’s configuration before allowing its main process to run.

The final command lists all containers. A running container has a running status; a container created but not started appears as stopped or created, depending on the Docker state shown by the CLI.

Create and start it in one command

For most small VPS deployments, docker run is simpler:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo docker run -d --name web -p 8080:80 nginx

Each option has a separate job:

  • sudo docker run creates a new container and starts it.
  • -d or --detach runs the container in the background and returns control of the terminal.
  • --name web assigns the name web, which you can use in later Docker commands.
  • -p 8080:80 publishes host port 8080 and forwards it to container port 80.
  • nginx is the image from which the container is created.

After the command completes, verify the result:

sudo docker ps -a

If the container is running, the published port should be shown in the listing. If it is stopped, the process inside the container has exited or startup failed; the container itself still exists and can be inspected with the same all-containers listing.

Use Docker’s official getting-started image

Docker’s run reference uses this example:

sudo docker run --detach --name welcome --publish 8080:80 docker/welcome-to-docker

It is equivalent in purpose to the shorter form: it runs in the background, names the container welcome, and publishes the service on port 8080 of the VPS. The long options make the command easier to read in documentation and deployment notes: --detach means the same as -d, and --publish means the same as -p.

Rank #3
New Bee Guitar Cable 10ft Electric Instrument Bass AMP Cord
  • [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
  • [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
  • [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
  • [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
  • [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by

Do not run both examples with the same name and host port at the same time. Container names must be unique, and two containers cannot normally claim the same host port. Choose one image, or choose a different name and host port for the second container.

Understand port publishing on a VPS

Host port versus container port

The syntax is -p HOST_PORT:CONTAINER_PORT. In -p 8080:80, clients connect to port 8080 on the VPS, while the application inside the container receives traffic on port 80. The numbers do not have to match; -p 9000:80 would expose the same container service through port 9000 on the host.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Publishing a port does not change the application inside the image. It creates the forwarding rule that makes a container port reachable through the VPS network interface.

Default network exposure

When no host IP is supplied, Docker publishes the port on all interfaces by default, represented by 0.0.0.0. On a public VPS, that can make the service reachable from the internet if the provider’s network rules and the host firewall permit it. Treat every published port as an exposure decision, not merely a local convenience.

Before starting a public service, check the VPS firewall and any cloud-provider firewall. Allow only the ports that should be reachable. If the service is intended only for local software or an administrative tunnel, configure an appropriate host-IP binding instead of accepting the all-interface default; the exact binding should match your network design.

Publishing all exposed ports

-P or --publish-all publishes only ports that the image declares with Dockerfile EXPOSE or that are supplied with --expose. It does not publish every port a process might happen to open, and it does not let you choose a stable host port in the same explicit way as -p HOST_PORT:CONTAINER_PORT. Use explicit -p mappings when clients need a known VPS port.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
BSIMB 15.6" Digital Family Calendar & Chore Chart, No Subscription Fees
  • Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
  • Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
  • All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
  • Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
  • Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.

Verify that the container is usable

Check running containers

sudo docker ps

docker ps shows running containers. Confirm that the expected name, image, status, and port mapping are present.

Include stopped containers

sudo docker ps -a

Use the -a option whenever a container is missing from the running list. It distinguishes several common situations: the container was never started, it started and then exited, or it is currently running but you are looking at an incomplete command result.

Test the service from the VPS

For the examples above, the intended endpoint is the VPS on port 8080. A browser or HTTP client should target the server’s address and that port, subject to the VPS firewall and any upstream security group. If the service is not reachable, check the Docker listing first, then confirm that the host port is allowed by the firewall. A correct container does not override a blocked network path.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Why a detached container may stop

A detached container is not a virtual machine that stays alive independently of its workload. It remains running while its root process is running. When that root process exits, the container exits as well. This behavior matters when an image is designed for a short command rather than a long-lived service.

For a web container, the image must start its web server as the container’s main process. If that process terminates because of a configuration error or another failure, docker ps will no longer show the container, while docker ps -a will still show it. The presence of a container record therefore proves that creation succeeded, not that the service is currently healthy.

The --rm option can remove a container automatically after its root process exits. That can keep short-lived test containers tidy, but it also removes the stopped container record that would otherwise help you investigate an exit. For a first deployment, omitting --rm leaves the container available in docker ps -a while you troubleshoot.

Troubleshoot the most common creation failures

“Docker command not found”

Docker Engine is not installed, or the shell cannot see the installed CLI. Return to the official Ubuntu installation process, remove conflicting packages, configure the official apt repository, and complete the Engine installation before running the container commands.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Permission denied when talking to Docker

The current account does not have permission to access the Docker daemon. Run the command with sudo, as in the examples, or ask the VPS administrator to configure an approved non-root Docker access method.

The name is already in use

Docker names identify individual containers. If web already exists, create the new container with another name, or start the existing one with sudo docker start web. Do not assume that repeating docker run --name web ... will replace the original container; it attempts to create another container with a duplicate name.

The host port is already allocated

Another service or container is using the selected VPS port. Choose an unused host port and keep the container port unchanged, or stop the conflicting service after confirming that doing so is safe. The mapping can be changed only when creating the container, so a new container may be required for a different publication rule.

The container appears in ps -a but not in ps

It is not running. If you used docker create, start it explicitly with sudo docker start NAME. If you used docker run -d, the root process may have exited. Check the image’s expected startup behavior and the container’s status before changing network settings.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The port is published but the site is unreachable

Check three separate layers: the container is running, the mapping uses the intended host and container ports, and the VPS or provider firewall allows the host port. Because an unspecified host IP publishes on all interfaces, a failure caused by an overly restrictive firewall is different from an accidental public exposure caused by an overly broad rule.

A repeatable deployment checklist

  1. Connect to the Linux VPS and confirm that your account can use sudo.
  2. Remove conflicting packages such as docker.io and docker-compose when present.
  3. Install Docker Engine from Docker’s official apt repository for the Ubuntu release on the VPS.
  4. Run sudo docker ps to confirm that the CLI can reach the daemon.
  5. Choose the image and identify the port the application listens on inside the container.
  6. Choose a unique container name and an available VPS host port.
  7. Use docker create followed by docker start when you want separate preparation and activation, or use docker run -d for a one-command deployment.
  8. Review the exposure implied by -p; without a host IP, Docker binds the published port on all interfaces.
  9. Run sudo docker ps -a and confirm that the expected container state and mapping are present.
  10. Test the service through the VPS address and host port, then adjust firewall rules only as needed.

Which command should you use?

Choose docker run when the image, name, and port mapping are known and you want the usual create-and-start workflow. It reduces the chance of forgetting the separate docker start step.

Choose docker create followed by docker start when provisioning and activation are separate operational stages, when another person or process must review the configuration, or when you want to demonstrate exactly when a container begins executing its root process.

Whichever path you choose, the reliable verification loop is the same: start the container, run docker ps to see active containers, and fall back to docker ps -a whenever a container is absent or has stopped. That distinction—created, running, or exited—prevents most first-deployment confusion on a Linux VPS.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

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

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.