--- title: Sending commands --- [RCON](http://wiki.vg/RCON) is enabled by default, so you can `exec` into the container to access the Minecraft server console: ``` docker exec -i mc rcon-cli ``` Note: The `-i` is required for interactive use of rcon-cli. To run a simple, one-shot command, such as stopping a Minecraft server, pass the command as arguments to `rcon-cli`, such as: ``` docker exec mc rcon-cli stop ``` _The `-i` is not needed in this case._ If rcon is disabled you can send commands by passing them as arguments to the packaged `mc-send-to-console` script. For example, a player can be op'ed in the container `mc` with: ```shell docker exec mc mc-send-to-console op player | | +- container name +- Minecraft commands start here ``` In order to attach and interact with the Minecraft server, add `-it` when starting the container, such as docker run -d -it -p 25565:25565 --name mc itzg/minecraft-server With that you can attach and interact at any time using docker attach mc and then Control-p Control-q to **detach**. For remote access, configure your Docker daemon to use a `tcp` socket (such as `-H tcp://0.0.0.0:2375`) and attach from another machine: docker -H $HOST:2375 attach mc Unless you're on a home/private LAN, you should [enable TLS access](https://docs.docker.com/articles/https/).