Install Netstat In Docker Container


To install the Docker container platform you need the root access rights for the host system. Switch to root with the command. Run the repository update. # apt-get update. Install everything that is needed to complete the next steps. # apt-get install. I executed following command to confirm that this port is not being used by any service on host machine: 1. Netstat -aon findstr 1534. I changed the port in docker-compose.override.yml file for rendering host service. I executed docker-compose up -d command to create containers and installation was successful this time.

Netstat is provided by the net-tools package,net-tools is probably not installed by default in the Docker image for Ubuntu 16.04 to keep the image size as small as possible. Execute the following commands inside docker container: apt update apt install net-tools. Improve this answer. The first thing that you need to do is to create a new container, map host-container ports, and enter container shell by issuing the below command: # docker run -it -p 81:80 ubuntu-nginx /bin/bash # nginx &. Here, the -p option exposes the host port to the container port. While the host port can be arbitrary, with the condition that it should.

How to get Docker running on FreeBSD 12

Jails vs Docker

Over the last couple of months I came across multiple questions on how to run Docker on FreeBSD. Usually the discussion ends up
in advocating Jails as the native FreeBSD solution (which it is). But often then not outside requirements dictate the use of the Docker container solution.

Not to repeat the discussion, and there are plenty of already, but if you are looking for segregation of a set of processes
with containers and you don’t rely on any hubs to do so, Jails most likely will fit the bill.

But this post is about the cases you can not or want to. The idea outlined here is not new and reflects
the setup on FreeNAS and in a wider sense how it is done on Windows and OSX.


To give you an idea what we are going to do:

  1. Setup FreeBSD with Bhyve (which means you need a machine capable todo so. Check the FreeBSD manual )
  2. Install Debian 9 onto a newly created VM.
  3. Install Docker there.
  4. Open up Docker remote API.
  5. Install Portainer to manage containers from the outside (web).

Key thing to highlight is that there is no docker command available on FreeBSD. So running CLI commands
will need you to login into the Debian VM or use the web interface.

The FreeBSD pkg repo has a package called Docker and Docker-compose which work great with the docker daemon running in the VM.
Set the DOCKER_HOST env to the ipaddress and port eg This gives a native interface with docker from FreeBSD.

Setup Bhyve

I assume you have FreeBSD running on your machine with Bhyve enabled and ready to go.
Personally I use the FreeBSD package vm-bhyve to run VMs on Bhyve. Install it via the pkg command. You know the drill.
Please follow the setup guide on Github.
Make sure to setup the virtual switch.

Create a new VM with the Debian template:

$ sudo vm create -t debian -s 20G debian

Edit the generated debian.conf file in the directory (eg /zrt/vm/debian) holding the VM files and add more memory and cpu
to fit your needs.

Download the Debian iso:

$sudo vm iso https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-9.6.0-amd64-netinst.iso

Install the Debian VM:

sudo vm install debian debian-9.6.0-amd64-netinst.iso

Check that the tap0 interface opened by Bhyve is connected to the Bhyve bridge.

Complete the Debian install:

Console into the VM and complete the typical Debian installation. If the installer is unable to
obtain an IP address then check the network settings (bridge and vm-bhyve switch)

$ sudo vm console debian

After completing the installation you should have a minimum Debian installation.

Add additional packages to make life easier:
$ apt-get install vim net-tools
Coming from BSD the lack of ifconfig or netstat is quite painful.

Install Docker

Please follow the Docker installation guide
After that follow this to open the API for remote access.

Docker is now fully configure and the hello-world should work:

$ docker run hello-world

Docker Management with Portainer

I assume you want to use a web frontend but you can as easily run Docker commands from within the VM.
Login via ssh or via vm console debian

Portainer is a web interface for Docker with a nice dashboard and logging capabilities.
Installation if pretty straight forward:

Run these commands from inside the VM:

Get the VM’s IP address:

$ ip address

And navigate to port 9000 to finish the install of Portainer. You could use a local socket connection but then every link in Portainer is
mapped to where when you would choose the external environment and use the IP address these mappings would work like you would expect.

These settings can be changed at Endpoints.


This is the rough outline of how to get Docker running on FreeBSD.

Is it wise to open the API?

Well you should secure that port with firewall rules
in a production setting.


  • Added info about the docker pkg.

Many debugging tasks of PlayFab Multiplayer Servers can be done locally using LocalMultiplayerAgent. However, sometimes the behavior of the game server can differ between the local environment and the actual service so you would like to connect directly to debug a running server because it is marked as unhealthy or not performing as expected.

In order to connect to the VM hosting your game server (either Windows or Linux), you can get Remote Desktop (RDP)/SSH credentials using the 'Connect' button on playfab.com web application. You can see this button on the 'Virtual Machines' page on your Multiplayer Build) or using CreateRemoteUser API call.

As soon as you connect to the VM, you can use the console of the operating system to monitor your game servers. MPS service uses Docker containers to spin up game server processes. To run Docker CLI commands, you'll need an admin powershell on Windows and sudo su - on Linux.


These are advanced Docker container debugging instructions. Using these instructions may break your game servers. We do not recommend using these commands on containers running your production game servers.

We strongly advise you not to take any dependency on behavior or information you see while debugging the containers. Only publicly documented APIs and behavior are supported, other things can change without notice.

Instructions for both Windows and Linux

How can I get started with Docker containers?

Regardless if you're developing on Linux or Windows, you should get acquainted with the basics of Docker containers.

You can watch the official 'Get Started' video here (external link) and experiment in an interactive playground on Katacoda (external link). To learn more about Windows Containers, see Windows and containers.

Once I RDP/SSH into the VM, how can I see a list of my running game servers running in Docker containers?

Use docker ps. You will see container name and hashes as well as port mapping from the VM port(s) to the Docker container port(s).

How can I see the ports used by my game servers?

This information is listed on docker ps. You will see something like that:

In this case, port 30000 on the VM is mapped onto 3600 on the container for TCP whereas 30001 on the VM is mapped on 3601 on the container for UDP. For more information, see Docker networking.


In both Windows and Linux, Docker containers are part of the 'playfab' Docker network. You can do docker inspect network playfab to see information about the network.

How can I see runtime details for a container?

Once you do docker ps you can grab the container name or hash and do docker inspect . You will see lots of information, like the state of the container, the volume binding on the host VM, port bindings, environment variables passed into the container and more.

How can I get the logs of my game server?

You can use the command docker logs . These logs contain everything your app sends to standard output/standard error streams. Bear in mind that these logs exist only for existing containers. If your game server crashes, our monitoring process in the VM will delete this container and create a new one.

Consequently, it's a better practice to use GSDK to log from inside your game server. To learn more, see Logging with GSDK and Archiving and retrieving multiplayer server logs to access the logs from terminated game servers.

Can I connect 'inside' a running container to see what's going on?

Yup! You can do docker exec -it powershell on Windows and docker exec -it bash on Linux. There, you get access to a command line process in the container where you can issue native commands to debug/diagnose issues.

For this command to work on Linux, Bash shell must be installed in your base container. If it isn't, you can use Bourne shell by running docker exec -it sh.

How can I see the ports that are open on my container?

Install Netstat In Docker Container Code

Once you are connected 'inside' the container, you can use netstat -ano on Windows and netstat -tulpn on Linux when you have a command line process inside your container (check the previous instruction).

If this command doesn't work on Linux, try installing netstat by apt update && apt install net-tools. On Linux, you can use nestatst -tulpn inside the VM to see that the ports are indeed open. Recall that VM ports will be different than container ports, you can see this port mapping with docker ps for your containers.

Linux specific instructions

Install netstat in docker container design

How can I see diagnostics about my container?

You can install apt install procps and then run:

  • ps -aux for the current running processes (observer that your main process in the container has a PID of 1. If this process dies, your container will be gone)
  • top for real time process information

How can I monitor TCP and UDP packets?

  • Consider using a tool like TCPdump (external link) utility.
  • Run apt update && apt install tcpdump to install it. In order to use it for a specific port, run tcpdump port 7777 for TCP and tcpdump udp port 7778 for UDP.

You can use tcpdump both from inside the VM and from inside the container. However, ensure that you will be monitoring for the correct port value, since there is a port mapping between VM ports and container ports.

Windows specific instructions

How can I determine the required DLLs that need to be in my asset package?

For instructions, see Determining required DLLs. This article is also useful if your game server fails to start because of one or more missing DLLs.

LocalMultiplayerAgent is crashing and restarting my Docker container with no error messages. Help!

When this happens, you would see an output similar to this.

Debugging steps

Install Netstat In Docker Containers

  • Check PF_ConsoleLogs.txt for any useful error message
  • Check if your .zip asset package contains all the required DLLs for your game. For instructions, see Determining required DLLs.
  • Check the Windows Event log to see if there's any useful information about Docker failures

On LocalMultiplayerAgent, I am not getting any heartbeats

There might be some leftover containers from previous attempts. You can use docker ps -a to see all containers and docker rm -f to delete them.

On Windows, how can I monitor TCP and UDP packets?

Install Netstat In Docker Container List

Consider using a tool like Wireshark (external link) utility.

Install Netstat In Docker Container Model

How can I debug a deployed multiplayer server using Visual Studio?

Install Netstat In Docker Container Model

For instructions, see Using Visual Studio to debug servers

Install Netstat In Docker Container Design

See also

  • Most Viewed News

    • Itunes For Macos Catalina
    • Slack Osx
    • Jackbox Party Pack 5 Mac Free Download
    • Suse Docker Install