{"id":122565,"date":"2025-02-11T13:09:18","date_gmt":"2025-02-11T13:09:18","guid":{"rendered":"\/tutorials\/?p=122565"},"modified":"2025-11-28T18:11:02","modified_gmt":"2025-11-28T18:11:02","slug":"docker-exec-command","status":"publish","type":"post","link":"\/in\/tutorials\/docker-exec-command","title":{"rendered":"How to use docker exec command in containers"},"content":{"rendered":"<p>The <strong>docker exec<\/strong> command lets you run new commands inside a Docker container that is already running.<\/p><p>Here&rsquo;s what you can do with the <strong>docker exec<\/strong> command:<\/p><ul class=\"wp-block-list\">\n<li><strong>Access an interactive shell<\/strong>. Gain direct, terminal-like access to a container&rsquo;s environment for real-time debugging.<\/li>\n\n\n\n<li><strong>Execute single commands<\/strong>. Quickly run one-off commands, like listing files or checking a process, without starting a full shell session.<\/li>\n\n\n\n<li><strong>Start background processes<\/strong>. Use the <strong>detach<\/strong> flag to kick off long-running scripts or tasks inside the container.<\/li>\n\n\n\n<li><strong>Set temporary environment variables<\/strong>. Pass new environment variables to a specific command for testing or temporary overrides.<\/li>\n\n\n\n<li><strong>Access logs<\/strong>. Read log files, like <strong>access.log<\/strong> or <strong>error.log<\/strong>, directly from within the container.<\/li>\n\n\n\n<li><strong>Manage internal services<\/strong>. Interact with services running inside the container, such as checking the status of a web server or restarting a process.<\/li>\n\n\n\n<li><strong>Gain administrative access<\/strong>. Run commands as the root user to perform tasks that require elevated privileges, like installing packages.<\/li>\n<\/ul><p>\n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-what-is-the-docker-exec-command\">What is the docker exec command?<\/h2><p>The <strong>docker exec <\/strong>command is a core part of the Docker command-line interface (CLI) that provides a way to execute processes in a running container.<\/p><p>Unlike commands that create or manage containers themselves, <strong>docker exec<\/strong> operates exclusively on containers that are already active, giving you direct access to their internal environment.<\/p><p>This command is essential for container management because it lets you debug a running application, perform administrative tasks, or inspect its environment without stopping and restarting the container.<\/p><p>In production environments, it&rsquo;s your primary tool for live diagnostics and on-the-fly adjustments.<\/p><p>When you run <strong>docker exec<\/strong>, Docker uses Linux namespaces and <strong>cgroups<\/strong> to execute your command within the container&rsquo;s context. This means it sees the container&rsquo;s filesystem, network, and process space, not the host&rsquo;s.<\/p><p>This isolation ensures that your actions stay contained within that specific container without affecting others or the host system.<\/p><p>You can use <strong>docker exec<\/strong> to open an interactive shell (<strong>bash<\/strong> or <strong>sh<\/strong>) to look at files, check configurations, or install new packages for testing.<\/p><p>Beyond shells, it also handles one-off administrative commands like checking disk usage, modifying configuration files, or verifying that a service is responding correctly.<\/p><h3 class=\"wp-block-heading\" id=\"h-how-the-docker-exec-command-works\">How the docker exec command works<\/h3><p>The <strong>docker exec<\/strong> command works by targeting a running container and executing a specified command within its namespace. The basic syntax of <strong>docker exec<\/strong> is:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker exec [OPTIONS] CONTAINER_NAME_OR_ID COMMAND [ARG...]<\/pre><ul class=\"wp-block-list\">\n<li><strong>[OPTIONS]<\/strong>. Flags that modify how the command behaves, like running in interactive mode.<\/li>\n\n\n\n<li><strong>CONTAINER_NAME_OR_ID<\/strong>. The specific container you want to run the command in. You can get this by running <strong>docker ps<\/strong>.<\/li>\n\n\n\n<li><strong>COMMAND [ARG&hellip;]<\/strong>. The command you want to run inside the container, along with any arguments it needs.<\/li>\n<\/ul><p>Here are the most common flags you&rsquo;ll use:<\/p><ul class=\"wp-block-list\">\n<li><strong>-i (interactive)<\/strong>. Keeps the standard input (STDIN) open, so you can provide input to the command. This is essential for interactive sessions.<\/li>\n\n\n\n<li><strong>-t (tty)<\/strong>. Allocates a pseudo-TTY (terminal). This makes the terminal session inside the container behave like a real terminal and is almost always used with <strong>-i<\/strong> (as <strong>-it<\/strong>) for a stable, usable shell.<\/li>\n\n\n\n<li><strong>-d (detach)<\/strong>. Runs the command in the background (detached mode). The command starts, and your terminal is immediately freed up, rather than waiting for the command to finish.<\/li>\n\n\n\n<li><strong>-e, &ndash;env (environment variables)<\/strong>. Sets one or more environment variables just for this command. You can use this flag multiple times (for instance, <strong>&ndash;env VAR1=value1 &ndash;env VAR2=value2<\/strong>). <strong>-e<\/strong> is the shorthand for <strong>&ndash;env<\/strong>.<\/li>\n\n\n\n<li><strong>&ndash;privileged<\/strong>. Grants extended privileges to the executed command. This gives the command full access to the host&rsquo;s resources, similar to running as root on the host. Use this with extreme caution as it can compromise container isolation.<\/li>\n\n\n\n<li><strong>-u, &ndash;user<\/strong>. Runs the command as a specific user (by name or UID). This is useful for testing permissions or running commands as a non-root user for security.<\/li>\n\n\n\n<li><strong>-w, &ndash;workdir<\/strong>. Sets the working directory inside the container for the command, overriding the container&rsquo;s default.<\/li>\n<\/ul><h3 class=\"wp-block-heading\" id=\"h-prerequisites-before-using-the-docker-exec-command\">Prerequisites before using the docker exec command<\/h3><p>Before you can use <strong>docker exec<\/strong>, you need a few things in place:<\/p><ul class=\"wp-block-list\">\n<li><a href=\"\/in\/tutorials\/how-to-install-docker-on-ubuntu\">Docker installed and configured<\/a>. The Docker Engine (version <strong>1.3<\/strong> or later) must be installed on your system, and the Docker daemon must be running.<\/li>\n\n\n\n<li><a href=\"\/in\/tutorials\/how-to-create-docker-container\">A running Docker container<\/a>. The command only works on containers that are currently running. You can&rsquo;t use <strong>docker exec<\/strong> on a stopped or paused container.<\/li>\n\n\n\n<li><strong>Container ID or name<\/strong>. You must know the ID or name of the container you want to target. You can find this by running the <strong>docker ps<\/strong> command.<\/li>\n\n\n\n<li><strong>A valid command<\/strong>. The command you want to run (like <strong>ls<\/strong>, <strong>bash<\/strong>, or <strong>apt<\/strong>) must exist within the container&rsquo;s environment.<\/li>\n<\/ul><h2 class=\"wp-block-heading\" id=\"h-practical-examples-of-the-docker-exec-command\">Practical examples of the docker exec command<\/h2><p>Practical examples of the <strong>docker exec<\/strong> command include running a shell in a container, setting environment variables, and executing commands with root privileges. The following sections cover these common tasks.<\/p><p><div><p class=\"important\"><strong>Important!<\/strong> Docker commands often require <strong>sudo<\/strong> privileges by default. To simplify this, you can add your user to the <strong>docker<\/strong> group to run commands without sudo. This guide omits <strong>sudo<\/strong> for clarity, but remember to add it to your commands if you haven&rsquo;t configured the <strong>docker<\/strong> group.<\/p><\/div>\n\n\n\n<\/p><h3 class=\"wp-block-heading\" id=\"h-running-a-shell-in-a-container\">Running a shell in a container<\/h3><p>One of the most common uses of <strong>docker exec<\/strong> is to access a running container&rsquo;s shell. This lets you interact with the container&rsquo;s filesystem, execute commands directly, and perform troubleshooting.<\/p><p>To start an interactive shell inside a container, use the <strong>-it<\/strong> flags:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker exec -it container_name_or_id \/bin\/bash<\/pre><p>Here&rsquo;s a breakdown:<\/p><ul class=\"wp-block-list\">\n<li><strong>-it<\/strong>. Combines the <strong>-i<\/strong> (interactive) and <strong>-t<\/strong> (tty) flags to give you a fully interactive terminal session.<\/li>\n\n\n\n<li><strong>\/bin\/bash<\/strong>. The command you&rsquo;re running, which in this case is the Bash shell.<\/li>\n<\/ul><p>If the container doesn&rsquo;t have Bash installed (common in minimal images like Alpine), you can use <strong>sh<\/strong> instead:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker exec -it container_name_or_id \/bin\/sh<\/pre><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e0632ceab14\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" width=\"1024\" height=\"67\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2025\/02\/run-shell-1024x67.png\" alt=\"Terminal window showing docker exec command with \/bin\/sh\" class=\"wp-image-122575\" srcset=\"https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2025\/02\/run-shell-1024x67.png 1024w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2025\/02\/run-shell-300x20.png 300w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2025\/02\/run-shell-150x10.png 150w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2025\/02\/run-shell-768x50.png 768w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2025\/02\/run-shell.png 1460w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>This method is essential for debugging and exploring the internals of a container without stopping it.<\/p><h3 class=\"wp-block-heading\" id=\"h-running-a-single-command-inside-a-container\">Running a single command inside a container<\/h3><p>You can use <strong>docker exec<\/strong> to run a single command inside a running container without opening a full shell session.<\/p><p>For example, to list the files in a container&rsquo;s root filesystem, you can use:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker exec container_name_or_id ls \/<\/pre><p>This command executes<strong> ls \/<\/strong> inside the specified container, listing the files and directories in the root directory.<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e0632cec308\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" width=\"1024\" height=\"194\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2025\/02\/docker-ls-1024x194.png\" alt=\"Terminal window showing docker exec command to list files with ls \/\" class=\"wp-image-122576\" srcset=\"https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2025\/02\/docker-ls-1024x194.png 1024w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2025\/02\/docker-ls-300x57.png 300w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2025\/02\/docker-ls-150x28.png 150w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2025\/02\/docker-ls-768x145.png 768w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2025\/02\/docker-ls.png 1460w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>If you want to view files in a specific directory, just include the path:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker exec container_name_or_id ls \/app<\/pre><p>This is a quick and efficient way to check file contents or configurations without starting an interactive session.<\/p><h3 class=\"wp-block-heading\" id=\"h-running-background-tasks\">Running background tasks<\/h3><p>The <strong>docker exec<\/strong> command can run tasks in the background using the <strong>-d<\/strong> (detach) flag. This runs the command and immediately returns control of your terminal.<\/p><p>For example, to run a maintenance script in the background:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker exec -d container_name_or_id \/usr\/local\/bin\/maintenance-script.sh<\/pre><p>The <strong>-d<\/strong> flag runs the command in the background, so you can continue using your terminal. This approach is useful for starting long-running processes or non-interactive tasks inside a container.<\/p><h3 class=\"wp-block-heading\" id=\"h-passing-environment-variables\">Passing environment variables<\/h3><p>You can use the <strong>&ndash;env<\/strong> (or <strong>-e<\/strong> shorthand) flag to pass environment variables to a command. This is useful when a command needs specific configuration values.<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker exec --env GREETING=\"Hello, World!\" container_name_or_id sh -c 'echo $GREETING'<\/pre><p>In this case:<\/p><ul class=\"wp-block-list\">\n<li><strong>&ndash;env GREETING=&rdquo;Hello, World!&rdquo;<\/strong>. Defines the environment variable <strong>GREETING<\/strong>.<\/li>\n\n\n\n<li><strong>sh -c &lsquo;echo $GREETING&rsquo;<\/strong>. Starts a shell to execute the <strong>echo<\/strong> command, which then accesses the variable.<\/li>\n<\/ul><p>When executed, the output will display &ldquo;Hello, World!&rdquo;.<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e0632cedb1a\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" width=\"1024\" height=\"91\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2025\/02\/exec-env-variable-1024x91.png\" alt='Terminal output of docker exec --env command showing \"Hello, World!\"' class=\"wp-image-122578\" srcset=\"https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2025\/02\/exec-env-variable-1024x91.png 1024w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2025\/02\/exec-env-variable-300x27.png 300w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2025\/02\/exec-env-variable-150x13.png 150w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2025\/02\/exec-env-variable-768x68.png 768w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2025\/02\/exec-env-variable.png 1460w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>You can pass multiple environment variables by repeating the <strong>&ndash;env<\/strong> flag:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker exec -e VAR1=value1 -e VAR2=value2 container_name_or_id command<\/pre><p>    <p class=\"warning\">\n        <strong>Warning!<\/strong> Be cautious when passing sensitive data with environment variables, as they may be visible to other users on the system through process lists.    <\/p>\n    \n\n\n\n<\/p><h3 class=\"wp-block-heading\" id=\"h-accessing-a-specific-container-s-logs\">Accessing a specific container&rsquo;s logs<\/h3><p>You can use <strong>docker exec<\/strong> to access logs stored within a container by reading the log files directly. This is different from the <strong>docker logs<\/strong> command, which reads the container&rsquo;s standard output (STDOUT) and error (STDERR) streams.<\/p><p><div class=\"protip\">\n                    <h4 class=\"title\">&#129300; When to use this method<\/h4>\n                    <p> Only use <strong>docker exec<\/strong> to read log files when applications write to specific files (for example, <strong>\/var\/log\/app.log<\/strong>) instead of sending them to STDOUT. For standard container logging, always use the <strong>docker logs<\/strong> command instead, as it's more efficient and designed for this purpose.<\/p>\n                <\/div>\n\n\n\n<\/p><p>For instance, if a web server container stores logs at <strong>\/var\/log\/nginx\/access.log<\/strong>, you can access them with:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker exec container_name_or_id cat \/var\/log\/nginx\/access.log<\/pre><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e0632cef32e\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" width=\"1024\" height=\"93\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2025\/02\/access-logs-1024x93.png\" alt=\"Terminal output showing NGINX access log via docker exec\" class=\"wp-image-122579\" srcset=\"https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2025\/02\/access-logs-1024x93.png 1024w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2025\/02\/access-logs-300x27.png 300w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2025\/02\/access-logs-150x14.png 150w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2025\/02\/access-logs-768x69.png 768w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2025\/02\/access-logs.png 1460w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>If the log file is large, you can use other tools like <strong>tail<\/strong> to view only the most recent entries:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker exec container_name_or_id tail -n 50 \/var\/log\/nginx\/access.log<\/pre><h3 class=\"wp-block-heading\" id=\"h-interacting-with-services-inside-containers\">Interacting with services inside containers<\/h3><p><strong>docker exec<\/strong> lets you interact with services running inside a container, such as restarting a service or checking its status.<\/p><p><div><p class=\"important\"><strong>Important!<\/strong> Most Docker containers run a single process and lack init systems, so commands like <strong>service<\/strong> or <strong>systemctl<\/strong> are often unavailable (especially in minimal or Alpine images). The examples below only work in full OS images (like Ubuntu or CentOS) that include these service management tools.<\/p><\/div>\n\n\n\n<\/p><h3 class=\"wp-block-heading\" id=\"h-checking-a-service-s-status\"><strong>Checking a service&rsquo;s status<\/strong><\/h3><p>To check the status of a service (in containers that support it), you can use its service management command:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker exec container_name_or_id service nginx status<\/pre><p>This command displays whether the nginx service is active, running, or stopped.<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e0632cf0d24\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" width=\"1024\" height=\"59\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2025\/02\/nginx-status-1024x59.png\" alt=\"Terminal output of docker exec service nginx status command\" class=\"wp-image-122580\" srcset=\"https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2025\/02\/nginx-status-1024x59.png 1024w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2025\/02\/nginx-status-300x17.png 300w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2025\/02\/nginx-status-150x9.png 150w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2025\/02\/nginx-status-768x44.png 768w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2025\/02\/nginx-status.png 1460w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><h4 class=\"wp-block-heading\" id=\"h-restarting-a-service\"><strong>Restarting a service<\/strong><\/h4><p>To restart a service inside a container (for example, after changing a config file):<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker exec container_name_or_id service nginx restart<\/pre><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e0632cf2599\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" width=\"1024\" height=\"55\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2025\/02\/nginx-restart-1024x55.png\" alt=\"Terminal output showing docker exec command to restart NGINX\" class=\"wp-image-122581\" srcset=\"https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2025\/02\/nginx-restart-1024x55.png 1024w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2025\/02\/nginx-restart-300x16.png 300w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2025\/02\/nginx-restart-150x8.png 150w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2025\/02\/nginx-restart-768x42.png 768w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2025\/02\/nginx-restart.png 1460w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>On containers based on modern Linux distributions with systemd, you might need to use <strong>systemctl<\/strong> instead:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker exec container_name_or_id systemctl restart service_name<\/pre><p><div class=\"protip\">\n                    <h4 class=\"title\">&#128260; Production best practice<\/h4>\n                    <p> Treat containers as immutable units. When you need to restart a service or change configurations, reboot the entire container with <strong>docker restart<\/strong> or, better yet, update your container image and redeploy. This approach maintains consistency, reproducibility, and aligns with modern containerization principles.<\/p>\n                <\/div>\n\n\n\n<\/p><h3 class=\"wp-block-heading\" id=\"h-running-commands-with-root-privileges\">Running commands with root privileges<\/h3><p>By default, <strong>docker exec<\/strong> runs commands as the same user the container was started with.<\/p><p>If your container was built with a non-root USER instruction in the Dockerfile, commands will run as that user and may not have the permissions you need for administrative tasks.<\/p><p>To run commands with root (administrative) privileges when needed, use the <strong>-u root <\/strong>flag. For example, to update package list:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker exec -u root container_name_or_id apt update<\/pre><p>Or to change file ownership:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker exec -u root container_name_or_id chown user:user \/path\/to\/file<\/pre><p>You can also run commands as any specific user by specifying their username or UID:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker exec -u www-data container_name_or_id \/bin\/bash<\/pre><p>Always exercise caution when running commands as root, as improper changes can break your container.<\/p><h2 class=\"wp-block-heading\" id=\"h-troubleshooting-common-issues-with-the-docker-exec-command\">Troubleshooting common issues with the docker exec command<\/h2><p>Troubleshooting common issues with the <strong>docker exec<\/strong> command usually involves checking the container&rsquo;s status or resolving permission errors.<\/p><h3 class=\"wp-block-heading\" id=\"h-container-not-running\"><strong>Container not running<\/strong><\/h3><p>If you receive an error like <strong>&ldquo;Error response from daemon: Container&hellip;is not running&rdquo;<\/strong>, it means the container is stopped. <strong>docker exec<\/strong> only works on running containers.<\/p><p>First, use the <strong>docker ps<\/strong> command to list all active containers. If your container isn&rsquo;t listed, it&rsquo;s not running.<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e0632cf3f02\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" width=\"1024\" height=\"58\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2025\/02\/docker-ps-1024x58.png\" alt=\"Terminal output showing docker ps command listing containers\" class=\"wp-image-122587\" srcset=\"https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2025\/02\/docker-ps-1024x58.png 1024w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2025\/02\/docker-ps-300x17.png 300w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2025\/02\/docker-ps-150x8.png 150w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2025\/02\/docker-ps-768x43.png 768w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2025\/02\/docker-ps.png 1460w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>You can start it using <strong>docker start<\/strong>:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker start container_name_or_id<\/pre><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e0632d012f0\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" width=\"1024\" height=\"253\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2025\/02\/docker-start-1-1024x253.png\" alt=\"Terminal output showing a container started with docker start\" class=\"wp-image-122588\" srcset=\"https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2025\/02\/docker-start-1-1024x253.png 1024w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2025\/02\/docker-start-1-300x74.png 300w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2025\/02\/docker-start-1-150x37.png 150w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2025\/02\/docker-start-1-768x190.png 768w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2025\/02\/docker-start-1.png 1460w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>If the container is paused, you&rsquo;ll need to unpause it first with <strong>docker unpause container_name_or_id<\/strong>.<\/p><h3 class=\"wp-block-heading\" id=\"h-permission-issues\"><strong>Permission issues<\/strong><\/h3><p>You might encounter permission errors, especially if the container was started with a non-root user. If you try to run a command that requires administrative privileges, it will fail.<\/p><p>Try running the command with root privileges using the <strong>-u root<\/strong> flag:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker exec -u root container_name_or_id command<\/pre><p>Alternatively, you can run the command as a different specific user if you know one with the right access:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">  docker exec -u username container_name_or_id command<\/pre><p>If you still encounter permission issues, our guide on <a href=\"\/in\/tutorials\/how-to-fix-docker-permission-denied-error\">resolving Docker permission denied errors<\/a> can help.<\/p><h3 class=\"wp-block-heading\" id=\"h-incorrect-container-id-or-name\"><strong>Incorrect container ID or name<\/strong><\/h3><p>Make sure you&rsquo;re using the correct container ID or name in your command. It&rsquo;s easy to make a typo or reference a container that has been removed.<\/p><p>Use <strong>docker ps<\/strong> to get a fresh list of running containers and their names\/IDs.<\/p><h3 class=\"wp-block-heading\" id=\"h-command-not-found-errors\">Command not found errors<\/h3><p>If the command itself fails (for instance, &ldquo;executable file not found&rdquo; or &ldquo;OCI runtime exec failed&rdquo;), it means the command (like <strong>nano<\/strong> or <strong>vim<\/strong>) isn&rsquo;t installed inside the container.<\/p><p>This is particularly common with minimal images. You&rsquo;ll need to either:<\/p><ul class=\"wp-block-list\">\n<li>Install it using <strong>docker exec -u root container_name apt install package-name<\/strong>.<\/li>\n\n\n\n<li>Use an alternative command that is available, like <strong>vi<\/strong> instead of <strong>nano<\/strong>.<\/li>\n\n\n\n<li>Consider using <strong>docker debug<\/strong> for access to additional debugging tools.<\/li>\n<\/ul><h2 class=\"wp-block-heading\" id=\"h-next-step-deepen-your-docker-knowledge\">Next step: Deepen your Docker knowledge<\/h2><p>Mastering the<strong> docker exec<\/strong> command is a key step in managing containerized applications effectively. It&rsquo;s your primary tool for real-time debugging and administration within running containers.<\/p><p>But it&rsquo;s just one part of the wider Docker ecosystem. To build on what you&rsquo;ve learned and understand how this command fits into the complete container lifecycle &ndash; from building images to managing data and orchestration &ndash; check out our <a href=\"\/in\/tutorials\/docker-tutorial\">Docker tutorial<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The docker exec command lets you run new commands inside a Docker container that is already running. Here&rsquo;s what you can do with the docker exec command: What is the docker exec command? The docker exec command is a core part of the Docker command-line interface (CLI) that provides a way to execute processes in [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"\/in\/tutorials\/docker-exec-command\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":471,"featured_media":128436,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"rank_math_title":"","rank_math_description":"","rank_math_focus_keyword":"","footnotes":""},"categories":[22642,22640],"tags":[],"class_list":["post-122565","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-pre-installed-applications","category-vps"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/tutorials\/docker-exec-command","default":0},{"locale":"en-UK","link":"https:\/\/www.hostinger.com\/uk\/tutorials\/docker-exec-command","default":0},{"locale":"en-MY","link":"https:\/\/www.hostinger.com\/my\/tutorials\/docker-exec-command","default":0},{"locale":"en-PH","link":"https:\/\/www.hostinger.com\/ph\/tutorials\/docker-exec-command","default":0},{"locale":"en-IN","link":"https:\/\/www.hostinger.com\/in\/tutorials\/docker-exec-command","default":0},{"locale":"en-CA","link":"https:\/\/www.hostinger.com\/ca\/tutorials\/docker-exec-command","default":0},{"locale":"en-AU","link":"https:\/\/www.hostinger.com\/au\/tutorials\/docker-exec-command","default":0},{"locale":"en-NG","link":"https:\/\/www.hostinger.com\/ng\/tutorials\/docker-exec-command","default":0}],"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/posts\/122565","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/users\/471"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/comments?post=122565"}],"version-history":[{"count":17,"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/posts\/122565\/revisions"}],"predecessor-version":[{"id":128434,"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/posts\/122565\/revisions\/128434"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/media\/128436"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/media?parent=122565"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/categories?post=122565"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/tags?post=122565"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}